From f988c93a2f5a159f71ed1e09c167b322790b9290 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Feb 2023 16:52:56 +0900 Subject: [PATCH] fix: log exception --- system/Debug/Exceptions.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 163a96f94962..f6b013d6247a 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -123,6 +123,15 @@ public function exceptionHandler(Throwable $exception) [$statusCode, $exitCode] = $this->determineCodes($exception); + if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) { + log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [ + 'message' => $exception->getMessage(), + 'exFile' => clean_path($exception->getFile()), // {file} refers to THIS file + 'exLine' => $exception->getLine(), // {line} refers to THIS line + 'trace' => self::renderBacktrace($exception->getTrace()), + ]); + } + $this->request = Services::request(); $this->response = Services::response(); @@ -141,15 +150,6 @@ public function exceptionHandler(Throwable $exception) } // For backward compatibility - if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) { - log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [ - 'message' => $exception->getMessage(), - 'exFile' => clean_path($exception->getFile()), // {file} refers to THIS file - 'exLine' => $exception->getLine(), // {line} refers to THIS line - 'trace' => self::renderBacktrace($exception->getTrace()), - ]); - } - if (! is_cli()) { try { $this->response->setStatusCode($statusCode);