Uncaught exception logging

This commit is contained in:
VicDeo 2012-09-26 14:38:06 +03:00
parent bbf8bb0bb3
commit 2b6869bcea
2 changed files with 8 additions and 2 deletions

View File

@ -317,8 +317,9 @@ class OC{
self::initPaths();
register_shutdown_function(array('OC_Log', 'onShutdown'));
set_error_handler(array('OC_Log', 'onError' ));
register_shutdown_function(array('OC_Log', 'onShutdown'));
set_error_handler(array('OC_Log', 'onError'));
set_exception_handler(array('OC_Log', 'onException'));
// set debug mode if an xdebug session is active
if (!defined('DEBUG') || !DEBUG) {

View File

@ -47,6 +47,11 @@ class OC_Log {
return true;
}
}
// Uncaught exception handler
public static function onException($exception){
self::write('PHP', $exception->getMessage() . ' at ' . $exception->getFile() . '#' . $exception->getLine(), self::FATAL);
}
//Recoverable errors handler
public static function onError($number, $message, $file, $line){