Skip to content
Browse files

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.
  • Loading branch information...
1 parent 4b6475d commit e896b0b70cc21d3a13b886ecd55732db3f247ac2 @tilgovi tilgovi committed Oct 25, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/couchdb/couch_httpd.erl
4 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

0 comments on commit e896b0b

Please sign in to comment.
Something went wrong with that request. Please try again.