Skip to content

Commit

Permalink
Merge pull request moby#30764 from tiborvass/stacktrace-debug-mode
Browse files Browse the repository at this point in the history
Show stacktrace in daemon logs only if 500 internal error
  • Loading branch information
LK4D4 committed Feb 6, 2017
2 parents e06ae6f + f7d9bb6 commit dc15fe8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit dc15fe8

Please sign in to comment.