diff options
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php index 04c456a12d8..fa69a7d6076 100644 --- a/lib/base.php +++ b/lib/base.php @@ -662,9 +662,20 @@ class OC { $config = \OC::$server->get(\OCP\IConfig::class); if (!defined('PHPUNIT_RUN')) { - OC\Log\ErrorHandler::setLogger(\OC::$server->getLogger()); - $debug = $config->getSystemValue('debug', false); - OC\Log\ErrorHandler::register($debug); + $errorHandler = new OC\Log\ErrorHandler( + \OCP\Server::get(\Psr\Log\LoggerInterface::class), + ); + $exceptionHandler = [$errorHandler, 'onException']; + if ($config->getSystemValue('debug', false)) { + set_error_handler([$errorHandler, 'onAll'], E_ALL); + if (\OC::$CLI) { + $exceptionHandler = ['OC_Template', 'printExceptionErrorPage']; + } + } else { + set_error_handler([$errorHandler, 'onError']); + } + register_shutdown_function([$errorHandler, 'onShutdown']); + set_exception_handler($exceptionHandler); } /** @var \OC\AppFramework\Bootstrap\Coordinator $bootstrapCoordinator */ |