From b20a0c411804e6b72c27c3802b726ac0e7f1f9bd Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Wed, 6 Jun 2018 11:40:08 -0700 Subject: [PATCH] agent: global logger should use the same flags Prior to this change logs from the global logger only used seconds: ``` 2018/06/06 18:25:58 http: TLS handshake error from ... ``` After this change they properly use the microseconds flag: ``` 2018/06/06 18:39:50.702447 http: TLS handshake error ... ``` They still lack a log level unfortunately. --- command/agent/agent.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/command/agent/agent.go b/command/agent/agent.go index f4dc89526..b9bd554b9 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -81,6 +81,9 @@ func NewAgent(config *Config, logOutput io.Writer, inmem *metrics.InmemSink) (*A InmemSink: inmem, } + // Global logger should match internal logger as much as possible + log.SetFlags(log.LstdFlags | log.Lmicroseconds) + if err := a.setupConsul(config.Consul); err != nil { return nil, fmt.Errorf("Failed to initialize Consul client: %v", err) }