Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.230 diff -u -F^f -r1.230 bootstrap.inc --- includes/bootstrap.inc 6 Oct 2008 22:40:20 -0000 1.230 +++ includes/bootstrap.inc 11 Oct 2008 00:32:24 -0000 @@ -801,7 +801,7 @@ function request_uri() { */ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) { global $user, $base_root; - + static $in_error_state = FALSE; // It is possible that the error handling will itself trigger an error. In that case, we could @@ -823,9 +823,28 @@ function watchdog($type, $message, $vari 'timestamp' => REQUEST_TIME, ); - // Call the logging hooks to log/process the message - foreach (module_implements('watchdog', TRUE) as $module) { - module_invoke($module, 'watchdog', $log_message); + if (function_exists('module_implements')) { + // Call the logging hooks to log/process the message + foreach (module_implements('watchdog', TRUE) as $module) { + module_invoke($module, 'watchdog', $log_message); + } + } + else { + // This section is for handling errors that happen too early, before module.inc + // gets loaded. If that happens, we don't have module_implements() yet, and therefore + // Drupal will abort. So we log stuff to a special flat file log. + // + // Add the following line of code to settings.php if you want different logs for + // different sites, or if you want to change the location of the log. + // + // $drupal_log = '/var/tmp/www.example.com.log'; + // + global $drupal_log; + if (!$drupal_log) { + $drupal_log = '/tmp/drupal.log'; + } + + @file_put_contents($drupal_log, date('c') . "\n" . print_r($log_message, TRUE) . "\n", FILE_APPEND); } } $in_error_state = FALSE;