couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject [3/4] git commit: log 5xx responses at error level
Date Thu, 25 Oct 2012 16:43:48 GMT
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/master
Commit: e896b0b70cc21d3a13b886ecd55732db3f247ac2
Parents: 4b6475d
Author: Randall Leeds <randall@apache.org>
Authored: Thu Oct 25 09:38:18 2012 -0700
Committer: Randall Leeds <randall@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,


Mime
View raw message