mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-26 18:30:54 +08:00
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.
This commit is contained in:
parent
7d5047c1f1
commit
eead337324
|
@ -244,6 +244,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
// successfully, so now just log the error
|
// successfully, so now just log the error
|
||||||
if errStatus >= 500 {
|
if errStatus >= 500 {
|
||||||
logger.Error(errMsg, errFields...)
|
logger.Error(errMsg, errFields...)
|
||||||
|
} else {
|
||||||
|
logger.Debug(errMsg, errFields...)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// well... this is awkward
|
// well... this is awkward
|
||||||
|
@ -262,6 +264,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
if errStatus >= 500 {
|
if errStatus >= 500 {
|
||||||
logger.Error(errMsg, errFields...)
|
logger.Error(errMsg, errFields...)
|
||||||
|
} else {
|
||||||
|
logger.Debug(errMsg, errFields...)
|
||||||
}
|
}
|
||||||
w.WriteHeader(errStatus)
|
w.WriteHeader(errStatus)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user