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
- Blog post with early version of proposal and screen shots: Drupal 6: proposal for a watchdog hook for logging and alerts.
- Drupal.org issue: Create a watchdog to enable customized logging and alerts via modules.
- Documentation on converting your modules from 5.x to 6.x, describing the new hook_watchdog, what it does, as well as examples for usage.
- The new hook_watchdog at api.drupal.org.
- Dries commit #63601.
- Drupal contributed project: Logging and alerts.
- Drupal groups: Funding of backport of watchdog external logging for Drupal 5.
Comments
Visitor (not verified)
one more change for watchdog
Tue, 2007/04/10 - 14:18Unfortunately 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
Khalid
Now available for Drupal 5.1
Mon, 2007/06/04 - 18:59A backport of this patch is now available for Drupal 5.1.
--
2bits -- Drupal and Backdrop CMS consulting
Visitor (not verified)
Very useful
Sun, 2008/11/30 - 21:11I'm writing an enterprise app that needs to talk to Nagios and alert sysadmins of certain events. This is very useful indeed!