Browse Source

Uncaught exception logging

tags/v5.0.0alpha1
VicDeo 11 years ago
parent
commit
2b6869bcea
2 changed files with 8 additions and 2 deletions
  1. 3
    2
      lib/base.php
  2. 5
    0
      lib/log.php

+ 3
- 2
lib/base.php 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) {

+ 5
- 0
lib/log.php 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){

Loading…
Cancel
Save