Skip to content

Commit

Permalink
MM-62926: Fix standard logger redirection issue (mattermost#30137)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
agnivade authored Feb 8, 2025
1 parent ffb3a34 commit 3698808
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/channels/app/platform/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (ps *PlatformService) initLogging() error {
}

// 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).
mlog.InitGlobalLogger(ps.logger)
Expand Down

0 comments on commit 3698808

Please sign in to comment.