From f8ded993afcf8fbaaa316404c8b0368cf1d16aae Mon Sep 17 00:00:00 2001 From: Johannes Scheuermann Date: Mon, 9 Mar 2020 10:45:21 +0100 Subject: [PATCH] agent: log error when agent crashes in an early stage (#7411) --- command/agent/agent.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command/agent/agent.go b/command/agent/agent.go index fd29ccbc9e..2b22f32e06 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -221,6 +221,7 @@ func (c *cmd) run(args []string) int { memSink, err := lib.InitTelemetry(config.Telemetry) if err != nil { c.logger.Error(err.Error()) + logGate.Flush() return 1 } @@ -229,6 +230,7 @@ func (c *cmd) run(args []string) int { agent, err := agent.New(config, c.logger) if err != nil { c.logger.Error("Error creating agent", "error", err) + logGate.Flush() return 1 } agent.LogOutput = logOutput