Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 01:30 UTC
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.
Francis Lavoie committed
Nov 22, 2021 at 13:58 UTC
eead337324593ef5cd30ebce2be26da84de00787
1 file changed
+4
modules/caddyhttp/server.go
+4
@@ -244,6 +244,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
244
// successfully, so now just log the error
245
if errStatus >= 500 {
246
logger.Error(errMsg, errFields...)
247
+ } else {
248
+ logger.Debug(errMsg, errFields...)
249
}
250
} else {
251
// well... this is awkward
@@ -262,6 +264,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
264
} else {
265
if errStatus >= 500 {
266
logger.Error(errMsg, errFields...)
267
+ } else {
268
+ logger.Debug(errMsg, errFields...)
269
}
270
w.WriteHeader(errStatus)
271
}