mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-62926: Fix standard logger redirection issue (#30137)
We were redirecting any logging happening via the Go standard logger to our own mlog instance. The issue is that all those logs were happening at LvlStdLog level which is higher than LvlDebug. LvlStdLog is at 10, and LvlDebug is at 5. So unless a customer sets the log level specifically to "stdlog" or sets up advanced logging to specifically log for that level, no standard logs will ever get logged. We fix this by logging it at warn level. The reason for warn is that mostly external libraries use this facility to log out-of-band errors that could not be returned using standard error returns. I saw another plugin error which was logged similarly. This was never surfaced before due to this bug. https://mattermost.atlassian.net/browse/MM-62926 ```release-note NONE ```
This commit is contained in:
parent
ffb3a34289
commit
3698808625
@ -54,7 +54,7 @@ func (ps *PlatformService) initLogging() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// redirect default Go logger to app logger.
|
// redirect default Go logger to app logger.
|
||||||
ps.logger.RedirectStdLog(mlog.LvlStdLog)
|
ps.logger.RedirectStdLog(mlog.LvlWarn)
|
||||||
|
|
||||||
// use the app logger as the global logger (eventually remove all instances of global logging).
|
// use the app logger as the global logger (eventually remove all instances of global logging).
|
||||||
mlog.InitGlobalLogger(ps.logger)
|
mlog.InitGlobalLogger(ps.logger)
|
||||||
|
Loading…
Reference in New Issue
Block a user