Pages

Wednesday, March 17, 2010

Disable error reporting to the screen on a production site in Drupal


By default, Drupal error logging happens to the log database (the watchdog table) and the screen. This is something I had overlooked for quite a while untill I stumbeled upon it while setting the error pages.
By default, Drupal error logging happens to the log database (the watchdog table) and the screen.
Error logging to the screen is quite ugly on a production site. Your visitors don't understand what's happening. It happend to me a few times on sites where I enabled page caching. The client notified me of the error messages so I disabled the caching without know I had the option to disable the error logging to the screen.
So how is this done?
The best solution for this problem is just to make sure you don't have errors in your site. That's utopia. But there's a better solution.
Go to Administer > Site configuration > Error reporting (admin/settings/error-reporting). There you have a dropdown list under 'Error reporting' with the two choices you have for the error logging, being:
  • Write errors to the log.
  • Write errors to the log and to the screen.
The page even contains a hint to guide you in the right direction:
Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.
Just choose 'Write errors to the log.' and your visitiors won't be bugged by (to them) meaningless error messages.

No comments:

Post a Comment