mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #30764 from tiborvass/stacktrace-debug-mode
Show stacktrace in daemon logs only if 500 internal error
This commit is contained in:
commit
dc15fe8a34
1 changed files with 6 additions and 1 deletions
|
@ -138,7 +138,12 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := handlerFunc(ctx, w, r, vars); err != nil {
|
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)
|
httputils.MakeErrorHandler(err)(w, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue