[CRI] Reduce clutter of log entries during process execution

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas 2021-01-06 08:57:31 -05:00
parent 18ad79d328
commit 1f5b84f27c
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
4 changed files with 11 additions and 11 deletions

View File

@ -114,7 +114,7 @@ func (c *ContainerIO) Pipe() {
c.stdout.Close() c.stdout.Close()
c.stdoutGroup.Close() c.stdoutGroup.Close()
wg.Done() wg.Done()
logrus.Infof("Finish piping stdout of container %q", c.id) logrus.Debugf("Finish piping stdout of container %q", c.id)
}() }()
} }
@ -127,7 +127,7 @@ func (c *ContainerIO) Pipe() {
c.stderr.Close() c.stderr.Close()
c.stderrGroup.Close() c.stderrGroup.Close()
wg.Done() wg.Done()
logrus.Infof("Finish piping stderr of container %q", c.id) logrus.Debugf("Finish piping stderr of container %q", c.id)
}() }()
} }
} }

View File

@ -99,7 +99,7 @@ func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} {
} }
e.closer.wg.Done() e.closer.wg.Done()
wg.Done() wg.Done()
logrus.Infof("Finish piping %q of container exec %q", t, e.id) logrus.Debugf("Finish piping %q of container exec %q", t, e.id)
} }
if opts.Stdout != nil { if opts.Stdout != nil {

View File

@ -164,14 +164,14 @@ func (c *criService) execInternal(ctx context.Context, container containerd.Cont
} }
// Wait for the process to be killed. // Wait for the process to be killed.
exitRes := <-exitCh exitRes := <-exitCh
log.G(ctx).Infof("Timeout received while waiting for exec process kill %q code %d and error %v", log.G(ctx).Debugf("Timeout received while waiting for exec process kill %q code %d and error %v",
execID, exitRes.ExitCode(), exitRes.Error()) execID, exitRes.ExitCode(), exitRes.Error())
<-attachDone <-attachDone
log.G(ctx).Debugf("Stream pipe for exec process %q done", execID) log.G(ctx).Debugf("Stream pipe for exec process %q done", execID)
return nil, errors.Wrapf(execCtx.Err(), "timeout %v exceeded", opts.timeout) return nil, errors.Wrapf(execCtx.Err(), "timeout %v exceeded", opts.timeout)
case exitRes := <-exitCh: case exitRes := <-exitCh:
code, _, err := exitRes.Result() code, _, err := exitRes.Result()
log.G(ctx).Infof("Exec process %q exits with exit code %d and error %v", execID, code, err) log.G(ctx).Debugf("Exec process %q exits with exit code %d and error %v", execID, code, err)
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "failed while waiting for exec %q", execID) return nil, errors.Wrapf(err, "failed while waiting for exec %q", execID)
} }

View File

@ -247,12 +247,12 @@ func (in *instrumentedService) ExecSync(ctx context.Context, r *runtime.ExecSync
if err := in.checkInitialized(); err != nil { if err := in.checkInitialized(); err != nil {
return nil, err return nil, err
} }
log.G(ctx).Infof("ExecSync for %q with command %+v and timeout %d (s)", r.GetContainerId(), r.GetCmd(), r.GetTimeout()) log.G(ctx).Debugf("ExecSync for %q with command %+v and timeout %d (s)", r.GetContainerId(), r.GetCmd(), r.GetTimeout())
defer func() { defer func() {
if err != nil { if err != nil {
log.G(ctx).WithError(err).Errorf("ExecSync for %q failed", r.GetContainerId()) log.G(ctx).WithError(err).Errorf("ExecSync for %q failed", r.GetContainerId())
} else { } else {
log.G(ctx).Infof("ExecSync for %q returns with exit code %d", r.GetContainerId(), res.GetExitCode()) log.G(ctx).Debugf("ExecSync for %q returns with exit code %d", r.GetContainerId(), res.GetExitCode())
log.G(ctx).Debugf("ExecSync for %q outputs - stdout: %q, stderr: %q", r.GetContainerId(), log.G(ctx).Debugf("ExecSync for %q outputs - stdout: %q, stderr: %q", r.GetContainerId(),
res.GetStdout(), res.GetStderr()) res.GetStdout(), res.GetStderr())
} }
@ -265,13 +265,13 @@ func (in *instrumentedService) Exec(ctx context.Context, r *runtime.ExecRequest)
if err := in.checkInitialized(); err != nil { if err := in.checkInitialized(); err != nil {
return nil, err return nil, err
} }
log.G(ctx).Infof("Exec for %q with command %+v, tty %v and stdin %v", log.G(ctx).Debugf("Exec for %q with command %+v, tty %v and stdin %v",
r.GetContainerId(), r.GetCmd(), r.GetTty(), r.GetStdin()) r.GetContainerId(), r.GetCmd(), r.GetTty(), r.GetStdin())
defer func() { defer func() {
if err != nil { if err != nil {
log.G(ctx).WithError(err).Errorf("Exec for %q failed", r.GetContainerId()) log.G(ctx).WithError(err).Errorf("Exec for %q failed", r.GetContainerId())
} else { } else {
log.G(ctx).Infof("Exec for %q returns URL %q", r.GetContainerId(), res.GetUrl()) log.G(ctx).Debugf("Exec for %q returns URL %q", r.GetContainerId(), res.GetUrl())
} }
}() }()
res, err = in.c.Exec(ctrdutil.WithNamespace(ctx), r) res, err = in.c.Exec(ctrdutil.WithNamespace(ctx), r)
@ -282,12 +282,12 @@ func (in *instrumentedService) Attach(ctx context.Context, r *runtime.AttachRequ
if err := in.checkInitialized(); err != nil { if err := in.checkInitialized(); err != nil {
return nil, err return nil, err
} }
log.G(ctx).Infof("Attach for %q with tty %v and stdin %v", r.GetContainerId(), r.GetTty(), r.GetStdin()) log.G(ctx).Debugf("Attach for %q with tty %v and stdin %v", r.GetContainerId(), r.GetTty(), r.GetStdin())
defer func() { defer func() {
if err != nil { if err != nil {
log.G(ctx).WithError(err).Errorf("Attach for %q failed", r.GetContainerId()) log.G(ctx).WithError(err).Errorf("Attach for %q failed", r.GetContainerId())
} else { } else {
log.G(ctx).Infof("Attach for %q returns URL %q", r.GetContainerId(), res.Url) log.G(ctx).Debugf("Attach for %q returns URL %q", r.GetContainerId(), res.Url)
} }
}() }()
res, err = in.c.Attach(ctrdutil.WithNamespace(ctx), r) res, err = in.c.Attach(ctrdutil.WithNamespace(ctx), r)