From 830d50e9c57cc0baca8dae9dc507275e824bcfd8 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Wed, 27 Jun 2018 11:58:42 +0100 Subject: [PATCH] main: Pass runtime CLI command to vc logger Add the runtime CLI command name to the virtcontainers logger so that it is clear when reading virtcontainers log entries which runtime command they refer to. Fixes #448. Signed-off-by: James O. D. Hunt --- cli/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/main.go b/cli/main.go index 99a4a890e..ed3bcdf4d 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