watchdog() (in includes/bootstrap.inc, not watchdog.module since we no longer have such a module) should be able to avoid invoking hook_watchdog() implementations when the level of the event is lower than a system-defined logging level, i.e. with a WATCHDOG_* constant higher than this level, due to the actual values of these constants.
This would reduce some long-standing performance issues with useless logging. Without going into per-source or per-implementation settings, and without defining a UI, it could be made 100% compatible with the current situation while still fixing this bug:
- define a watchdog_minimum_level variable in settings.php, defaulting to WATCHDOG_DEBUG to keep all events by default
- only invoke the hook for events above that level
That way existing code would not be affected, but sites with watchdog chatter issues could reduce the "noise" and increase performance.
PASSED: [[SimpleTest]]: [MySQL] 40,632 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 35,393 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 35,398 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] 33,362 pass(es), 45 fail(s), and 45 exception(s). View