Logging via Syslog is somewhat FUBARd
otheus opened this issue · 1 comments
The brilliant logging framework here unfortunately does not play well with unix syslog logging facility. The problem here is that the CSysLogRoute uses the inherited log-format function which adds date, time, log-level, and a newline. All of this meta-information is implicitly handled by the syslog() call. Thus, operators will see log lines such as:
[2021-01-01 12:00:00] [user.info] [limesurvey] 2021-01-01 12:00:00 [info] some random log message no newline
[2021-01-01 12:00:00] [user.info] [limesurvey] 2021-01-01 12:00:00 [info]
Thank you for your contribution. I agree the current CSysLogRoute contains redundant information, but we cannot make this change because we have to keep the releases backward compatible.
You can change this for your own projects by extending CSysLogRoute to your own class.
MySysLogRoute extends CSysLogRoute
{
protected function formatLogMessage($message,$level,$category,$time)
{
return 'your custom formatting'
}
}
(take a look at Yii 2's SyslogTarget for more inspiration: https://github.com/yiisoft/yii2/blob/master/framework/log/SyslogTarget.php#L81)