diff --git a/library/Icinga/Application/Logger.php b/library/Icinga/Application/Logger.php index 185d54379..fd246c26f 100755 --- a/library/Icinga/Application/Logger.php +++ b/library/Icinga/Application/Logger.php @@ -28,6 +28,7 @@ namespace Icinga\Application; +use Icinga\Protocol\Ldap\Exception; use \Zend_Config; use \Zend_Log; use \Zend_Log_Filter_Priority; @@ -144,7 +145,6 @@ final class Logger if ($target == self::DEFAULT_LOG_TARGET) { $type = self::DEFAULT_LOG_TYPE; } - $this->addWriter($type, $target, Zend_Log::DEBUG); } @@ -187,11 +187,17 @@ final class Logger ); return; } - try { - /** @var Zend_Log_Writer_Abstract $writer */ - $writer = new $writerClass(Config::resolvePath($target)); + + $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' && !file_exists($target)) { + touch($target); + chmod($target, 0664); + } + $this->logger->addWriter($writer); $this->writers[] = $writer; } catch (Zend_Log_Exception $e) { diff --git a/library/Icinga/User/Preferences/IniStore.php b/library/Icinga/User/Preferences/IniStore.php index 4a88383e9..0bd98ec63 100644 --- a/library/Icinga/User/Preferences/IniStore.php +++ b/library/Icinga/User/Preferences/IniStore.php @@ -152,6 +152,8 @@ class IniStore implements LoadInterface, FlushObserverInterface private function createDefaultIniFile() { touch($this->preferencesFile); + chmod($this->preferencesFile, 0664); + } /**