diff --git a/system/Log/Logger.php b/system/Log/Logger.php index 4de39d1bc8..36cfec8033 100644 --- a/system/Log/Logger.php +++ b/system/Log/Logger.php @@ -364,10 +364,14 @@ class Logger implements LoggerInterface foreach ($this->handlerConfig as $className => $config) { + if ( ! array_key_exists($className, $this->handlers)) { + $this->handlers[$className] = new $className($config); + } + /** * @var \CodeIgniter\Log\Handlers\HandlerInterface */ - $handler = new $className($config); + $handler = $this->handlers[$className]; if ( ! $handler->canHandle($level)) {