Rethinking watchdog(): Monolog architecture

Submitted by Frederic Marand on

I've been discussing Monolog in Drupal events (DrupalCamp Lyon, DevDays Barcelona) as a possible alternative to the legacy Drupal watchdog() service for quite some time, but never took the time to explain it in writing, and the feature freeze date is looming ahead, so since I'm taking part in th Gent code sprint, and code has been starting to take shape here, here, and there, here is an overview of the Monolog classes.

The diagram below is a simplified version of the Monolog architecture. It includes all classes and interfaces, but only the most significant methods, no constants, and none of the non-bundled classes and interfaces upon which some of the builtins depend.

simplified class diagram for Monolog 1.1 (SVG rendering)

And, on its own page because of its size, here is the complete equivalent Monolog data model diagram.

What's next ? Hopefully reviewing and completing the patches completing the integration, and a post explaining how all of this works together, paving the way for smart usage of that package in core and elsewhere.

Erik (not verified)

Sat, 2012-11-03 13:58

This is very similar to the Apache log4php project. I already have some baseline implementation in Drupal that may be of interest to you.

If you have anything different from , yes please provide information: in the meantime, I added the results of my own comparisons between the two packages.

To summarize, while both are obviously really powerful, log4php feels old, and with more of a "corporate IT" feel with Java strings all over, while Monolog feels lean, mean, and in the "PHP renaissance" spirit around 5.3/5.4 and heralded by Symfony2, Composer, and hopefully Drupal 8. Just a personal PoV, of course.

I completely agree. I chose to use log4php as it's a common standard that likely resonates with developers of other languages, rather than using something very particular to Drupal or PHP.