[erlang-questions] erlang-questions] inets httpd mod_log output issue

Paul Fisher pfisher@REDACTED
Mon May 12 13:42:36 CEST 2008


On Mon, 2008-05-12 at 11:59 +0200, Ingela Anderton Andin wrote:
> Paul Fisher wrote:
> > We (like I suspect lots of other production shops) write human
> > readable/parsible logs as single line per entry, which is what 'compact'
> > seemed to be.
> >
> >   
> Well, if that is what web-application  developers wants maybe that is 
> what we should make it into?!
> Maybe our first assumption does not hold up.
> I am just trying to explain what the initial intent was. We will take 
> this under consideration.

I'm sorry that I misinterpreted your initial response.  I read "will not
fix", which is what generated my private message to you.  I would like
to make "single-line" logging work readably with inets mod_log, so lets
see if there is something we can work out as an acceptable patch.

What I ended up doing in my local R12B-2 build is the following, which
appears to work without breaking things:

--- inets/src/http_server/httpd_log.erl.orig    2008-05-09 10:13:24.000000000 -0500
+++ inets/src/http_server/httpd_log.erl 2008-05-09 10:32:38.000000000 -0500
@@ -104,6 +104,10 @@
        pretty ->
           io_lib:format("[~s] server crash for ~s, reason: ~n~p~n~n", 
                         [Date, RemoteHost, Reason]);
+       compact when is_list(Reason), is_integer(hd(Reason)),
+                     hd(Reason) > 0, hd(Reason) =< 255 ->
+           io_lib:format("[~s] server crash for ~s, reason: ~s~n", 
+                         [Date, RemoteHost, Reason]);
        compact ->
           io_lib:format("[~s] server crash for ~s, reason: ~w~n", 
                         [Date, RemoteHost, Reason])
@@ -115,6 +119,10 @@
        pretty ->
           io_lib:format("[~s] access to ~s failed for ~s reason: ~n~p~n",
                         [Date, URI, RemoteHost, Reason]);
+       compact when is_list(Reason), is_integer(hd(Reason)),
+                     hd(Reason) > 0, hd(Reason) =< 255 ->
+           io_lib:format( "[~s] access to ~s failed for ~s, reason: ~s~n", 
+                          [Date, URI, RemoteHost, Reason]);
        compact ->
           io_lib:format( "[~s] access to ~s failed for ~s, reason: ~w~n", 
                         [Date, URI, RemoteHost, Reason])            


-- 
paul




More information about the erlang-questions mailing list