summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Leeds <randall@apache.org>2012-10-25 09:38:18 -0700
committerRandall Leeds <randall@apache.org>2012-10-25 09:41:46 -0700
commite896b0b70cc21d3a13b886ecd55732db3f247ac2 (patch)
treefeb98db1ad3c683f6cd457c2ac212760d48ea1fc
parent4b6475da2cd9ff392736e52a6b834e7827fe3ee3 (diff)
downloadcouchdb-e896b0b70cc21d3a13b886ecd55732db3f247ac2.tar.gz
log 5xx responses at error level
This change should reduce the risk that administrators fail to recognize correctable server errors without creating excess noise. If malformed requests start throwing 5xx errors into the logs, we should look at detecting them and reporting a better error, probably a 4xx, but it's more important that an admin known that, e.g., the permissions of a .couch file are wrong.
-rw-r--r--src/couchdb/couch_httpd.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 1fdfb0c35..45ceebcd1 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -669,7 +669,9 @@ send_response(#httpd{mochi_req=MochiReq}=Req, Code, Headers, Body) ->
log_request(Req, Code),
couch_stats_collector:increment({httpd_status_codes, Code}),
Headers2 = http_1_0_keep_alive(MochiReq, Headers),
- if Code >= 400 ->
+ if Code >= 500 ->
+ ?LOG_ERROR("httpd ~p error response:~n ~s", [Code, Body]);
+ Code >= 400 ->
?LOG_DEBUG("httpd ~p error response:~n ~s", [Code, Body]);
true -> ok
end,