Browse Source

Delay creation of error logger.

Mark Story 4 years ago
parent
commit
aa3066cba9
1 changed files with 1 additions and 2 deletions
  1. 1 2
      src/Error/ExceptionTrap.php

+ 1 - 2
src/Error/ExceptionTrap.php

@@ -341,7 +341,6 @@ class ExceptionTrap
      */
     public function logException(Throwable $exception, ?ServerRequestInterface $request = null): void
     {
-        $logger = $this->logger();
         $shouldLog = true;
         foreach ($this->_config['skipLog'] as $class) {
             if ($exception instanceof $class) {
@@ -350,7 +349,7 @@ class ExceptionTrap
             }
         }
         if ($shouldLog) {
-            $logger->log($exception, $request);
+            $this->logger()->log($exception, $request);
         }
         $this->dispatchEvent('Exception.beforeRender', ['exception' => $exception]);
     }