The PHP Error Logger receives PHP notices, warnings, errors and exceptions and places them in an easy-to-read and manage table. The Error logger allows you to filter by error type (e.g. Notice or Exception) or search within error messages.
- Ruby >= 1.9.3
- MongoDB installed ("brew install mongo")
-
Clone this repo into a directory on your local.
-
Run "rake start"
-
"rake start" will run the bundle script the first time it is run to install necessary gems.
-
"rake start" will run shotgun and mongo simultaneously. Visit the page at http://127.0.0.1:9393.
-
Place the following code somewhere in your Drupal PHP script:
set_error_handler('php_error_logger_log_msg');
function php_error_logger_log_msg($errno, $errstr, $errfile, $errline) {
$backtrace = debug_backtrace();
$page = $_SERVER['REQUEST_URI'];
$a = array(
'level' => $errno,
'page' => $page,
'message' => $errstr,
'file' => $errfile,
'line' => $errline,
'time' => time(),
'backtrace' => str_replace(
array('\"', '\\/'),
array('"', '/'),
json_encode($backtrace)
),
);
$d = '';
foreach ($a AS $key => $val) {
$d .= "$key=$val&";
}
$d = substr($d, 0, -1);
// Send the post data.
$options = array(
'headers' => array(
'Content-type' => 'application/x-www-form-urlencoded',
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
),
'method' => 'POST',
'data' => $d,
);
$result = drupal_http_request('http://127.0.0.1:9393/write', $options);
}
- You're done! Browse around your site and errors will be automatically submitted to the error logger.