Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293938

Watchdog should work, even if the error is too early, before module.inc is loaded

$
0
0

This is not a present problem with core, although with some custom changes to core, it can manifest itself as WSOD.

If someone adds watchdog() calls too early, the module_implements() in the watchdog() function will cause an error, since module.inc would not have been loaded yet.

An example is some changes that we have on drupal.org itself (albeit in Drupal 5.x) where we have something like this in cache.inc to each function:

watchdog('cache', 'cache_set called');

This causes a WSOD, or an error and Drupal will abort. Even if you enable the syslog module, it will not work, because module.inc has not been loaded yet.

Discovering this the painful way on scratch.drupal.org while patching Drupal 5, I decided to have a workaround for it.

So, the attached patch provides a fallback method to log to a plain text file if that happens.

The patch allows a variable $drupal_log to be defined in settings.php and set to a writeable path to log those early errors.

As I said, this is quasi-hackish and is not committable in core in its current state. It is mainly here for those who have 'exotic' needs providing a way for not erroring out and still getting the info you need.


Viewing all articles
Browse latest Browse all 293938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>