diff --git a/src/github.com/matrix-org/dendrite/common/log.go b/src/github.com/matrix-org/dendrite/common/log.go index 625ef20a7..6bed9c9a3 100644 --- a/src/github.com/matrix-org/dendrite/common/log.go +++ b/src/github.com/matrix-org/dendrite/common/log.go @@ -8,13 +8,24 @@ import ( "github.com/matrix-org/dugong" ) +type utcFormatter struct { + logrus.Formatter +} + +func (f utcFormatter) Format(entry *logrus.Entry) ([]byte, error) { + entry.Time = entry.Time.UTC() + return f.Formatter.Format(entry) +} + // SetupLogging configures the logging format and destination(s). func SetupLogging(logDir string) { - formatter := &logrus.TextFormatter{ - TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", - DisableColors: true, - DisableTimestamp: false, - DisableSorting: false, + formatter := &utcFormatter{ + &logrus.TextFormatter{ + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", + DisableColors: true, + DisableTimestamp: false, + DisableSorting: false, + }, } if logDir != "" { _ = os.Mkdir(logDir, os.ModePerm)