You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ns...@apache.org on 2012/11/17 20:52:50 UTC

[21/30] git commit: log 5xx responses at error level

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.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/e896b0b7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/e896b0b7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/e896b0b7

Branch: refs/heads/docs
Commit: e896b0b70cc21d3a13b886ecd55732db3f247ac2
Parents: 4b6475d
Author: Randall Leeds <ra...@apache.org>
Authored: Thu Oct 25 09:38:18 2012 -0700
Committer: Randall Leeds <ra...@apache.org>
Committed: Thu Oct 25 09:41:46 2012 -0700

----------------------------------------------------------------------
 src/couchdb/couch_httpd.erl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e896b0b7/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 1fdfb0c..45ceebc 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,