From 8ca880d1cc39b0fc238bcfc8d81041f57d950317 Mon Sep 17 00:00:00 2001 From: Ibrahim Serdar Acikgoz Date: Wed, 23 Dec 2020 13:08:35 +0300 Subject: [PATCH] [MM-31512] Downgrade 4xx and 501 errors to info/debug level (#16585) * Downgrade 4xx and 501 errors to info/debug level * use switch instead --- web/handlers.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/handlers.go b/web/handlers.go index e7b242d98a..8d7a71a625 100644 --- a/web/handlers.go +++ b/web/handlers.go @@ -268,7 +268,15 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if c.Err.Id == "api.context.session_expired.app_error" { c.LogInfo(c.Err) } else { - c.LogError(c.Err) + code := c.Err.StatusCode + switch { + case code >= http.StatusBadRequest && code < http.StatusInternalServerError: + c.LogDebug(c.Err) + case code == http.StatusNotImplemented: + c.LogInfo(c.Err) + default: + c.LogError(c.Err) + } } c.Err.Where = r.URL.Path