Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 6713)
+++ wp-settings.php	(working copy)
@@ -185,6 +185,13 @@
 		define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
 }
 
+if( defined('WP_DEBUG') ) {
+	if( file_exists(ABSPATH . 'wp-content/debug.php') )
+		include ABSPATH . 'wp-content/debug.php';
+	else
+		require ABSPATH . WPINC . '/debug.php';
+}
+
 /**
  * Allows for the plugins directory to be moved from the default location.
  *
@@ -433,6 +440,9 @@
 if ( file_exists(TEMPLATEPATH . '/functions.php') )
 	include(TEMPLATEPATH . '/functions.php');
 
+if( defined('WP_DEBUG') )
+	add_action('shutdown', 'wp_log_shutdown');
+
 /**
  * shutdown_action_hook() - Runs just before PHP shuts down execution.
  *
