From eead337324593ef5cd30ebce2be26da84de00787 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Mon, 22 Nov 2021 13:58:25 -0500 Subject: [PATCH] caddyhttp: Log non-500 handler errors at debug level (#4429) Fixes #4428 It's best to still log handler errors at debug level so that they're hidden by default, but still accessible if additional details are necessary. --- modules/caddyhttp/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index 80948325d..26384af10 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -244,6 +244,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // successfully, so now just log the error if errStatus >= 500 { logger.Error(errMsg, errFields...) + } else { + logger.Debug(errMsg, errFields...) } } else { // well... this is awkward @@ -262,6 +264,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } else { if errStatus >= 500 { logger.Error(errMsg, errFields...) + } else { + logger.Debug(errMsg, errFields...) } w.WriteHeader(errStatus) }