From aa1a2316cbbdfa1fe57ff85c76181b920c1d00b3 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 22 Jan 2014 09:26:45 +0000 Subject: [PATCH] Avoid syslog-related exceptions refs #5522 --- library/Icinga/Application/Logger.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Application/Logger.php b/library/Icinga/Application/Logger.php index 2eb4144d9..ed163bf56 100755 --- a/library/Icinga/Application/Logger.php +++ b/library/Icinga/Application/Logger.php @@ -192,13 +192,15 @@ final class Logger try { $target = Config::resolvePath($target); - $writer = new $writerClass($target); - $writer->addFilter(new Zend_Log_Filter_Priority($priority)); // Make sure the permissions for log target file are correct if ($type === 'Stream' && substr($target, 0, 6) !== 'php://' && !file_exists($target)) { touch($target); chmod($target, 0664); + $writer = new $writerClass($target); + } elseif ($type === 'Syslog') { + $writer = new $writerClass(); } + $writer->addFilter(new Zend_Log_Filter_Priority($priority)); $this->logger->addWriter($writer); $this->writers[] = $writer;