You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/01 11:06:12 UTC
[36/49] chttpd commit: updated refs/heads/windsor-merge to 554ef74
Improve HTTP error log formatting
The use of `~p` for binaries and stacks wasn't very useful. This just
changes things around as well as puts the stack on a new line indented
four spaces so that its readable.
BugzId: 26121
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/d15303fb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/d15303fb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/d15303fb
Branch: refs/heads/windsor-merge
Commit: d15303fb3316e2da610241ce7fd5f238e6907e04
Parents: 3f3e916
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Dec 12 12:38:10 2013 -0600
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Jul 31 11:55:09 2014 +0100
----------------------------------------------------------------------
src/chttpd.erl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/d15303fb/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 372a61d..a783f91 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -893,8 +893,10 @@ maybe_decompress(Httpd, Body) ->
log_error_with_stack_trace({bad_request, _, _}) ->
ok;
log_error_with_stack_trace({Error, Reason, Stack}) ->
- couch_log:error("ref: ~p req_err ~p:~p ~p",
- [stack_hash(Stack), Error, Reason, Stack]);
+ EFmt = if is_binary(Error) -> "~s"; true -> "~w" end,
+ RFmt = if is_binary(Reason) -> "~s"; true -> "~w" end,
+ Fmt = "req_err(~w) " ++ EFmt ++ " : " ++ RFmt ++ "~n ~p",
+ couch_log:error(Fmt, [stack_hash(Stack), Error, Reason, Stack]);
log_error_with_stack_trace(_) ->
ok.