Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.181
diff -u -p -r1.181 bootstrap.inc
--- includes/bootstrap.inc	7 Aug 2007 08:41:24 -0000	1.181
+++ includes/bootstrap.inc	24 Aug 2007 23:20:17 -0000
@@ -707,6 +707,18 @@ function request_uri() {
 function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
   global $user, $base_root;
 
+  // If this is a PHP error, append a backtrace to the message for easier
+  // debugging. Because var_dump() does not return a value, need to use
+  // output buffering.
+  if ($type == 'php') {
+    $message .= '<pre>';
+    ob_start();
+    var_dump(debug_backtrace());
+    $message .= ob_get_contents();
+    ob_end_clean();
+    $message .= '</pre>';
+  }
+
   // Prepare the fields to be logged
   $log_message = array(
     'type'        => $type,
