Drupal 6: new hook_watchdog for logging and alerts

A week ago, I proposed a new hook_watchdog, so modules can decide where to send Drupal events, and not be limited to the watchdog table.

As of today, this patch is in core, and there is already two modules that use it, syslog, which is in core, and emaillog, which is part of the logging and alerts project.

This patch opens the door to many neat things, such as:

  • Making Drupal more suitable for the enterprise, since it could be integrated better into their monitoring and network management infrastructure.
  • Allows site admins to be notified of important events. This applies equally to large and small sites.
  • Helps scalability by not logging to the database, thus relieving the load.
  • Conforms to RFC 3164 for severity levels.
  • Allows integration with many more delivery channels such as SMS, Instant Messaging, ...etc.

Here are some resources for further reading.

Resources

Contents: 

Comments

one more change for watchdog

Unfortunately one more change is required for watchdog() calls. Now all calls have t() evaluated runtime, which results in a "nice" mix of languages used to log your messages regardless of where are those logged, if you have multiple languages supported on the site.

To fix this, watchdog() calls should have t() calls removed, and the messages should only get translated when displayed (in Drupal), and probably never if you collect them in some external application.

Relevant issue: http://drupal.org/node/76588

Very useful

I'm writing an enterprise app that needs to talk to Nagios and alert sysadmins of certain events. This is very useful indeed!