mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 15:24:05 +02:00
PhpWriter: replace newlines in the message only if PHP logs to Syslog
refs #11652
This commit is contained in:
parent
4689f224b5
commit
a85d259b0a
@ -36,9 +36,9 @@ class PhpWriter extends LogWriter
|
|||||||
*/
|
*/
|
||||||
public function log($severity, $message)
|
public function log($severity, $message)
|
||||||
{
|
{
|
||||||
if (! error_log(
|
if (! error_log($this->ident . ': ' . Logger::$levels[$severity] . ' - ' . (
|
||||||
$this->ident . ': ' . Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message)
|
ini_get('error_log') === 'syslog' ? str_replace("\n", ' ', $message) : $message
|
||||||
)) {
|
))) {
|
||||||
throw new NotWritableError('Could not log to ' . (ini_get('error_log') ?: 'SAPI'));
|
throw new NotWritableError('Could not log to ' . (ini_get('error_log') ?: 'SAPI'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user