Browse code

daemon: kill: use log level to "warn" if container doesn't exit in time

I noticed this log being logged as an error, but the kill logic actually
proceeds after this (doing a "direct" kill instead). While usually containers
are expected to be exiting within the given timeout, I don't think this
needs to be logged as an error (an error is returned after we fail to
kill the container).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/11/29 23:43:08
Showing 1 changed files
... ...
@@ -171,7 +171,7 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
171 171
 		return nil
172 172
 	}
173 173
 
174
-	log.G(ctx).WithError(status.Err()).WithField("container", container.ID).Errorf("Container failed to exit within %v of kill - trying direct SIGKILL", waitTimeout)
174
+	log.G(ctx).WithFields(log.Fields{"error": status.Err(), "container": container.ID}).Warnf("Container failed to exit within %v of kill - trying direct SIGKILL", waitTimeout)
175 175
 
176 176
 	if err := killProcessDirectly(container); err != nil {
177 177
 		if errors.As(err, &errNoSuchProcess{}) {