From f65e26bc2a7ce3e1cd9305d6b3d9d10b8dbe95be Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 20 Apr 2017 16:26:34 +0200 Subject: [PATCH] cmd: Configure logging before any log messages --- .../matrix-org/dendrite/cmd/dendrite-clientapi/main.go | 3 ++- .../matrix-org/dendrite/cmd/dendrite-sync-server/main.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go b/src/github.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go index 0346785e0..0fa0e6b65 100644 --- a/src/github.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go @@ -16,11 +16,12 @@ import ( ) func main() { + common.SetupLogging(os.Getenv("LOG_DIR")) + bindAddr := os.Getenv("BIND_ADDRESS") if bindAddr == "" { log.Panic("No BIND_ADDRESS environment variable found.") } - common.SetupLogging(os.Getenv("LOG_DIR")) // TODO: Rather than generating a new key on every startup, we should be // reading a PEM formatted file instead. diff --git a/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go b/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go index 3dc6b6cbf..a84dd8487 100644 --- a/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go @@ -34,6 +34,8 @@ func loadConfig(configPath string) (*config.Sync, error) { } func main() { + common.SetupLogging(os.Getenv("LOG_DIR")) + flag.Parse() if *configPath == "" { @@ -47,7 +49,6 @@ func main() { if *bindAddr == "" { log.Fatal("--listen must be supplied") } - common.SetupLogging(os.Getenv("LOG_DIR")) log.Info("sync server config: ", cfg)