summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-11-22 13:58:25 -0500
committerGitHub <noreply@github.com>2021-11-22 11:58:25 -0700
commiteead337324593ef5cd30ebce2be26da84de00787 (patch)
treea984ebb58f5b6a523fc62d7cd6a30820e3ee9f7b
parent7d5047c1f190421528695e1cc3a4ad71c97eb022 (diff)
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.
-rw-r--r--modules/caddyhttp/server.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index 8094832..26384af 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)
}