There are a few lines that you can add to settings.php to control which type of message are logged:
error_reporting(E_ERROR | E_PARSE | E_COMPILE_ERROR | E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING);
//$conf['error_level'] = 0; // None
$conf['error_level'] = 1; // Errors and warnings
//$conf['error_level'] = 2; // All messages
ini_set('display_errors', FALSE);
ini_set('display_startup_errors', FALSE);
error_reporting
The error_reporting
PHP function determines which types of error are logged (or shown on screen if you have E_ALL
or E_STRICT
set).
Because setting E_STRICT
or E_ALL
will show an error message on screen, in place of your site, it should not be used in production.
error_level
The error_level
config setting tells Drupal whether to log nothing, only error or warnings, or all messages. Logging can be intensive, so this is often set to 0 on production sites.
TODO (is this correct?): If you want to set the error_level
to 1, so that you log warnings as well as errors, then you need to make sure that error_reporting
includes a PHP warning flag (as in the example above).
display_errors
The PHP ini settings display_errors
and display_startup_errors
tell PHP whether to show errors on screen, which you’ll almost certainly want off on a production site.
Watchdog
Drupal’s core syslog module will hook in to watchdog via its syslog_watchdog
function and eventually write your watchdog messages using PHP’s syslog function.
Drupal’s watchdog levels presumably correspond to PHP’s syslog priorities, since that is what is passed to the syslog
command.
Reload settings.php
If you use APC for caching, then you’ll need to restart Apache with sudo apache2ctl graceful
.
Via the UI
You can control logging via the UI at admin/config/development/logging, however these settings will be overridden by anything in settings.php.