Avoid syslog-related exceptions

refs #5522
This commit is contained in:
Thomas Gelf 2014-01-22 09:26:45 +00:00
parent afbe8f0fcb
commit aa1a2316cb
1 changed files with 4 additions and 2 deletions

View File

@ -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;