diff options
Diffstat (limited to 'lib/private/legacy/OC_Template.php')
-rw-r--r-- | lib/private/legacy/OC_Template.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 422709cec7d..47803041cb5 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -9,6 +9,7 @@ use OC\TemplateLayout; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\AppFramework\Http\TemplateResponse; use OCP\EventDispatcher\IEventDispatcher; +use Psr\Log\LoggerInterface; require_once __DIR__.'/template/functions.php'; @@ -242,10 +243,10 @@ class OC_Template extends \OC\Template\Base { \OC::$server->get(IEventDispatcher::class)->dispatchTyped($event); print($response->render()); } catch (\Throwable $e1) { - $logger = \OC::$server->getLogger(); - $logger->logException($e1, [ + $logger = \OCP\Server::get(LoggerInterface::class); + $logger->error('Rendering themed error page failed. Falling back to un-themed error page.', [ 'app' => 'core', - 'message' => 'Rendering themed error page failed. Falling back to unthemed error page.' + 'exception' => $e1, ]); try { @@ -256,9 +257,9 @@ class OC_Template extends \OC\Template\Base { } catch (\Exception $e2) { // If nothing else works, fall back to plain text error page $logger->error("$error_msg $hint", ['app' => 'core']); - $logger->logException($e2, [ + $logger->error('Rendering un-themed error page failed. Falling back to plain text error page.', [ 'app' => 'core', - 'message' => 'Rendering unthemed error page failed. Falling back to plain text error page.' + 'exception' => $e2, ]); header('Content-Type: text/plain; charset=utf-8'); @@ -296,9 +297,9 @@ class OC_Template extends \OC\Template\Base { $content->printPage(); } catch (\Exception $e) { try { - $logger = \OC::$server->getLogger(); - $logger->logException($exception, ['app' => 'core']); - $logger->logException($e, ['app' => 'core']); + $logger = \OCP\Server::get(LoggerInterface::class); + $logger->error($exception->getMessage(), ['app' => 'core', 'exception' => $exception]); + $logger->error($e->getMessage(), ['app' => 'core', 'exception' => $e]); } catch (Throwable $e) { // no way to log it properly - but to avoid a white page of death we send some output self::printPlainErrorPage($e, $debug); |