Skip to content

Commit

Permalink
shim: Respect containerd's debug config
Browse files Browse the repository at this point in the history
There are too many logs from kata shim in containerd's log.
Fixes kata-containers#2209

Signed-off-by: choury <chouryzhou@tencent.com>
  • Loading branch information
choury committed Nov 21, 2019
1 parent 547d580 commit 51d7c23
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func New(ctx context.Context, id string, publisher events.Publisher) (cdshim.Shi
// it will output into stdio, from which containerd would like
// to get the shim's socket address.
logrus.SetOutput(ioutil.Discard)
opts := ctx.Value(cdshim.OptsKey{}).(cdshim.Opts)
if !opts.Debug {
logrus.SetLevel(logrus.WarnLevel)
}
vci.SetLogger(ctx, logger)
katautils.SetLogger(ctx, logger, logger.Logger.Level)

Expand Down Expand Up @@ -141,7 +145,10 @@ func newCommand(ctx context.Context, containerdBinary, id, containerdAddress str
"-address", containerdAddress,
"-publish-binary", containerdBinary,
"-id", id,
"-debug",
}
opts := ctx.Value(cdshim.OptsKey{}).(cdshim.Opts)
if opts.Debug {
args = append(args, "-debug")
}
cmd := sysexec.Command(self, args...)
cmd.Dir = cwd
Expand Down

0 comments on commit 51d7c23

Please sign in to comment.