Errors, Warnings, and Log Settings

Drupal Version
Tags

Fix Errors Whenever Possible

Although hiding error messages is important from a security perspective, errors and warnings mean that something isn't working correctly, and that could likely have a negative effect on your site.  It's best to try to fix them to fix them if you can (especially if they are in your own code), or for third-party contrib modules, report them to the module or project owner.

PHP Message Types

PHP, which Drupal runs under, can generate three types of messages:

  • Notices - Something to be aware of that you might want to do differently, but probably won't keep your site from working.
  • Warnings - More serious issues than Notices, but are not keeping your site from running.
  • Errors - A serious issue that has caused the site code to stop running before reaching a normal completion.

In short, errors are problems that have to be fixed, because they are impeding use of your site.  Warnings and notices ought to be fixed, but notices may be things that you have a reason for doing in an unusual way.

Drupal 7+ Message Settings

To change the way your Drupal 7 or 8 site shows PHP messages, go to the  Configuration -> Development -> Logging and errors (admin/config/development/logging) administrative control page.

The recommended settings for a live, production site are:

  • Error messages to display: None. 
  • Database log messages to keep: 100 (unless you need a longer audit trail)
  • Note: Do not enable the core syslog module if you are using OIT hosting.  According to the syslog module's documentation, it is not appropriate for shared hosting.  You should be able to find most useful debugging information by looking at the error logs, as described below.

Error Logs on OIT Web Hosting

If using OIT Web Hosting, you will find a record (or log) of errors the server is tracking in your Plesk control panel.

From the main panel, go into the Logs section and look for the log file called "error_log". You can either view or download this file, which lists detailed error log messages.

Other forms of web hosting will have their own logging areas where you can look for error logs.  Check with your server administrator to find out where the logs are on any non-OIT server that you might be using.

One thing to keep in mind is that server error logs will only contain messages from PHP.  Any messages generated by Drupal itself will be found in the Drupal Error log, found in the administrative area of your site under Reports -> Recent log messages.

Sample Error Messages on Web Hosting

Here are some examples of error messages you might find in your hosting log:

[Mon Jun 15 03:01:53 2014] [warn] RSA server certificate CommonName (CN) `hosting.gatech.edu' does NOT match server name!? 
[Mon Jun 15 08:52:25 2014] [error] [client 130.207.000.00] File does not exist: /var/www/vhosts/mysite.gatech.edu/httpdocs/favicon.ico, referer: http://mysite.gatech.edu/node/77 
[Mon Jun 15 09:03:20 2014] [warn] [client 130.207.000.00] mod_fcgid: stderr: PHP Warning:  chdir(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/vhosts/mysite.gatech.edu/:/tmp/:/usr/share/pear:/var/cache/hg:/opt/atomic/atomic-php55/root/usr/share/pear) in /var/www/vhosts/mysite.gatech.edu/httpdocs/custom-file.php on line 88