From 9b7defd37506e8b592b5c25cf1b1b8c15df4520a Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Fri, 21 Apr 2017 02:10:54 +0200 Subject: [PATCH] common/log: Always log to stderr --- .../matrix-org/dendrite/common/log.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/common/log.go b/src/github.com/matrix-org/dendrite/common/log.go index b8ea9547..79fee40f 100644 --- a/src/github.com/matrix-org/dendrite/common/log.go +++ b/src/github.com/matrix-org/dendrite/common/log.go @@ -33,6 +33,15 @@ func (f utcFormatter) Format(entry *logrus.Entry) ([]byte, error) { // SetupLogging configures the logging format and destination(s). func SetupLogging(logDir string) { + logrus.SetFormatter(&utcFormatter{ + &logrus.TextFormatter{ + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", + FullTimestamp: true, + DisableColors: false, + DisableTimestamp: false, + DisableSorting: false, + }, + }) if logDir != "" { _ = os.Mkdir(logDir, os.ModePerm) logrus.AddHook(dugong.NewFSHook( @@ -49,15 +58,5 @@ func SetupLogging(logDir string) { }, &dugong.DailyRotationSchedule{GZip: true}, )) - } else { - logrus.SetFormatter(&utcFormatter{ - &logrus.TextFormatter{ - TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", - FullTimestamp: true, - DisableColors: false, - DisableTimestamp: false, - DisableSorting: false, - }, - }) } }