reverseproxy: Log error at error level (fix #4360)

This commit is contained in:
Matthew Holt 2021-09-24 18:29:23 -06:00
parent 16f752125f
commit 3336faf254
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -574,12 +574,11 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, repl *
duration := time.Since(start) duration := time.Since(start)
logger := h.logger.With( logger := h.logger.With(
zap.String("upstream", di.Upstream.String()), zap.String("upstream", di.Upstream.String()),
zap.Duration("duration", duration),
zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}), zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}),
) )
if err != nil { if err != nil {
logger.Debug("upstream roundtrip", logger.Error("upstream roundtrip", zap.Error(err))
zap.Duration("duration", duration),
zap.Error(err))
return err return err
} }
logger.Debug("upstream roundtrip", logger.Debug("upstream roundtrip",