diff --git a/cli/main.go b/cli/main.go index 99a4a890eb..ed3bcdf4d9 100644 --- a/cli/main.go +++ b/cli/main.go @@ -235,10 +235,6 @@ func beforeSubcommands(context *cli.Context) error { return fmt.Errorf("unknown log-format %q", context.GlobalString("log-format")) } - setExternalLoggers(kataLog) - - ignoreLogging := false - // Add the name of the sub-command to each log entry for easier // debugging. cmdName := context.Args().First() @@ -246,6 +242,10 @@ func beforeSubcommands(context *cli.Context) error { kataLog = kataLog.WithField("command", cmdName) } + setExternalLoggers(kataLog) + + ignoreLogging := false + if context.NArg() == 1 && context.Args()[0] == envCmd { // simply report the logging setup ignoreLogging = true