Show stacktrace in daemon logs only if 500 internal error
Signed-off-by: Tibor Vass <tibor@docker.com> Upstream-commit: f7d9bb62483fa160553ef17840b1f974b12885ac Component: engine
This commit is contained in:
@@ -138,7 +138,12 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
||||
}
|
||||
|
||||
if err := handlerFunc(ctx, w, r, vars); err != nil {
|
||||
logrus.Errorf("Handler for %s %s returned error: %+v", r.Method, r.URL.Path, err)
|
||||
statusCode := httputils.GetHTTPErrorStatusCode(err)
|
||||
errFormat := "%v"
|
||||
if statusCode == http.StatusInternalServerError {
|
||||
errFormat = "%+v"
|
||||
}
|
||||
logrus.Errorf("Handler for %s %s returned error: "+errFormat, r.Method, r.URL.Path, err)
|
||||
httputils.MakeErrorHandler(err)(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user