From 1f8d4f0bcebe5c26a762178a32a78ba0068f74f3 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Thu, 1 Dec 2022 14:32:16 -0300 Subject: [PATCH] Log _SERVER when errors are found --- api/public/index.php | 7 ++++++- cli/public/index.php | 4 +++- ui/public/index.php | 6 ++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/api/public/index.php b/api/public/index.php index 9659116..9e2bc0e 100644 --- a/api/public/index.php +++ b/api/public/index.php @@ -8,6 +8,11 @@ Monolog\ErrorHandler::register($app->getContainer()->get(Psr\Log\LoggerInterface try { $app->run(); } catch (Error | Exception $e) { - $app->getContainer()->get(Psr\Log\LoggerInterface::class)->error($e); + $logger = $app->getContainer()->get(Psr\Log\LoggerInterface::class); + if (isset($_REQUEST)) { + $logger->debug(Safe\json_encode(compact('_REQUEST'))); + } + $logger->debug(Safe\json_encode(compact('_SERVER'))); + $logger->error($e); throw $e; } diff --git a/cli/public/index.php b/cli/public/index.php index aed6193..63341a5 100644 --- a/cli/public/index.php +++ b/cli/public/index.php @@ -8,6 +8,8 @@ Monolog\ErrorHandler::register($app->getContainer()->get(Psr\Log\LoggerInterface try { $app->run(); } catch (Error | Exception $e) { - $app->getContainer()->get(\Psr\Log\LoggerInterface::class)->error($e); + $logger = $app->getContainer()->get(Psr\Log\LoggerInterface::class); + $logger->debug(Safe\json_encode(compact('_SERVER'))); + $logger->error($e); throw $e; } diff --git a/ui/public/index.php b/ui/public/index.php index 7ef5588..9e2bc0e 100644 --- a/ui/public/index.php +++ b/ui/public/index.php @@ -8,9 +8,11 @@ Monolog\ErrorHandler::register($app->getContainer()->get(Psr\Log\LoggerInterface try { $app->run(); } catch (Error | Exception $e) { + $logger = $app->getContainer()->get(Psr\Log\LoggerInterface::class); if (isset($_REQUEST)) { - $app->getContainer()->get(Psr\Log\LoggerInterface::class)->debug(json_encode(compact('_REQUEST'))); + $logger->debug(Safe\json_encode(compact('_REQUEST'))); } - $app->getContainer()->get(Psr\Log\LoggerInterface::class)->error($e); + $logger->debug(Safe\json_encode(compact('_SERVER'))); + $logger->error($e); throw $e; }