Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 8535)
+++ wp-includes/functions.php	(working copy)
@@ -2329,4 +2329,34 @@
 	return $url;
 }
 
+/**
+ * Whether custom logging should be enabled and register custom error handler.
+ *
+ * The custom error handler function name is called,
+ * {@link wp_log_error_handler()} and should match the function definition
+ * defined at {@link http://php.net/set_error_handler set_error_handler() PHP.net}
+ * page. A plugin can replace the custom error handler, in order to save the
+ * errors to a file or a database. The custom error handler can't handle E_ERROR
+ * type errors and is a limitation of the PHP engine (mostly because it is going
+ * to whitescreen and you can't do anything about it).
+ *
+ * This starts the custom error handling and goes along with the
+ * {@link wp_stop_logging()} function when WordPress is complete. Plugins which
+ * need to know when they should save the error reporting to file or database
+ * should hook into 'wp_shutdown' hook in order to do so. If the plugin writes
+ * whenever it gets an error, then it need not do so.
+ *
+ * @since {@internal Version Unknown}}
+ *
+ * @return bool True if logging, false if not logging.
+ */
+function wp_start_logging() {
+	if ( (has_filter('start_logging') && apply_filters('start_logging', true)) || (defined('WP_DEBUG') && true === WP_DEBUG ) ) {
+		set_error_handler( 'wp_log_error_handler', E_ALL );
+		return true;
+	}
+
+	return false;
+}
+
 ?>
\ No newline at end of file
Index: wp-includes/pluggable.php
===================================================================
--- wp-includes/pluggable.php	(revision 8535)
+++ wp-includes/pluggable.php	(working copy)
@@ -1580,4 +1580,89 @@
 }
 endif;
 
-?>
+if ( !function_exists( 'wp_log' ) ) :
+/**
+ * Log a message based on severity of the problem.
+ *
+ * The severity parameter accepts only 'notice', 'low', 'medium', 'warning',
+ * 'high', and 'error' in that order of severity.
+ *
+ * @since {@internal Version Unknown}}
+ *
+ * @param string $type The area which the message was logged.
+ * @param string $message The message to display to the user about the problem.
+ * @param string $severity Severity level of the log message
+ * @return bool False if failed to log message, true if message was logged.
+ */
+function wp_log($type, $message, $severity) {
+	echo "<p><strong>{$type}</strong> (<em>{$severity}</em>: $message</p>";
+	return true;
+}
+endif;
+
+if ( !function_exists( 'wp_plugin_log' ) ) :
+/**
+ * Log a plugin message based on severity of the problem.
+ *
+ * The severity parameter accepts only 'notice', 'low', 'medium', 'warning',
+ * 'high', and 'error' in that order of severity.
+ *
+ * @since {@internal Version Unknown}}
+ *
+ * @param string $plugin Plugin Name
+ * @param string $message The message to display to the user about the problem.
+ * @param string $severity Severity level of the log message
+ * @return bool False if failed to log message, true if message was logged.
+ */
+function wp_plugin_log($plugin, $message, $severity) {
+	echo "<p><strong>{$plugin}</strong> (<em>{$severity}</em>: $message</p>";
+	return true;
+}
+endif;
+
+if ( !function_exists( 'wp_log_error_handler' ) ) :
+/**
+ * Custom WordPress error handler.
+ *
+ * @param int $iError
+ * @param string $strError
+ * @param string $strFile
+ * @param string $strLine
+ * @param array $arrContext
+ * @return bool
+ */
+function wp_log_error_handler($iError, $strError, $strFile, $strLine, $arrContext) {
+	$content = "<p>";
+
+	if( defined('E_RECOVERABLE_ERROR') && E_RECOVERABLE_ERROR === $iError ) {
+		$content .= "<strong>Recoverable Error</strong>: ";
+		return true;
+	}
+
+	switch( $iError ) {
+
+		case E_USER_ERROR:
+			$content .= "<strong>User Error</strong>: ";
+			break;
+
+		case E_USER_WARNING:
+		case E_WARNING:
+			$content .= "<strong>Warning</strong>: ";
+			break;
+
+		case E_USER_NOTICE:
+		case E_NOTICE:
+			$content .= "<strong>Notice</strong>: ";
+			break;
+		default:
+			return false;
+	}
+
+	$content .= "$strError found in <em>$strFile</em> on line <em>$strLine</em>.</p>";
+	echo $content;
+
+	return true;
+}
+endif;
+
+?>
\ No newline at end of file
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 8534)
+++ wp-settings.php	(working copy)
@@ -430,6 +430,8 @@
 
 require (ABSPATH . WPINC . '/pluggable.php');
 
+wp_start_logging();
+
 /*
  * In most cases the default internal encoding is latin1, which is of no use,
  * since we want to use the mb_ functions for utf-8 strings
