Problem/Motivation
In most cases, drupal_set_message() is just another channel for reporting information along with logging, and should be handled as such instead of requiring duplicate calls with inconsistent parameters.
Before anything else is done, we need to reach some consensus on whether this is desirable in the first instance. The motivation is to reduce the need for callers to send the same message to two channels (a logger and drupal_set_message()), but in many (most?) cases, the intended audience is different and it may not make sense to send the same message to both places.
Example 1: A form validation "error" because a user neglected to enter their zip code when creating a new account in is not necessarily an error that should be logged. Autorouting the drupal_set_message() call to the logger would be frivolous.
Example 2: In the event of a critical site error or database problem, it might make sense to send to the logger complete details (including the failing SQL statement and other details) while you would clearly not want this displayed to the end user (outside of a development environment).
On the other hand, a case might be made that UX developers and designers might in fact be interested in knowing which forms routinely result in validation errors (to spot fields or schemas that end users are regularly becoming confused about).
Proposed resolution
First, for this to happen in any automatic sense, the "error levels" or "categories" passed in the $type parameter to drupal_set_message() should be harmonized with the former watchdog() "error levels" (now provided for in Drupal\Core\Logger\RfcLoggerTrait). This element is essentially a duplicate of
#1251960: harmonize severity/type in watchdog and drupal_set_message β
and should be addressed in that issue.
Second, it has been proposed that messages set via drupal_set_message() should also be sent to the system logger.
Remaining tasks
As noted above, it is not yet clear precisely how this should be implemented, if it should be implemented at all. Further discussion about the merits of this change is required.
Postponing to 8.1.x because this is a feature request, along with its related issue, will cause backward compatibility issues and potentially drastically changed behaviour.
User interface changes
Not yet determined.
API changes
Not yet entirely determined, but clearly
#1251960: harmonize severity/type in watchdog and drupal_set_message β
would require a change to the drupal_set_message() function to harmonize the 'levels'.
Beta phase evaluation
<!--Uncomment the relevant rows for the issue. -->