25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

Small change in accesslog file format; fix bug when accesslog conf parameter wasn't present in the conf file (thanks to Jerome Sautret)

SVN Revision: 2185
This commit is contained in:
Badlop 2009-06-16 13:52:17 +00:00
parent b57248e822
commit 91193bf928

View File

@ -56,7 +56,7 @@ process(LocalPath, Request) ->
Result = serve(LocalPath), Result = serve(LocalPath),
case ets:lookup(mod_http_fileserver, accessfile) of case ets:lookup(mod_http_fileserver, accessfile) of
undefined -> [] ->
ok; ok;
[{accessfile, AccessFile}] -> [{accessfile, AccessFile}] ->
{Code, _, _} = Result, {Code, _, _} = Result,
@ -114,7 +114,7 @@ log(File, Code, Request) ->
% combined apache like log format : % combined apache like log format :
% 127.0.0.1 - - [28/Mar/2007:18:41:55 +0200] "GET / HTTP/1.1" 302 303 "-" "tsung" % 127.0.0.1 - - [28/Mar/2007:18:41:55 +0200] "GET / HTTP/1.1" 302 303 "-" "tsung"
% XXX TODO some fields are harcoded/missing (reply size, user agent or referer for example) % XXX TODO some fields are harcoded/missing (reply size, user agent or referer for example)
io:format(File, "~p - - [~p/~p/~p:~p:~p:~p] \"~s /~s~s\" ~p -1 \"-\" \"-\"~n", io:format(File, "~s - - [~p/~p/~p:~p:~p:~p] \"~s /~s~s\" ~p -1 \"-\" \"-\"~n",
[IP, Day, Month, Year, Hour, Minute, Second, Request#request.method, Path, Query, Code]). [IP, Day, Month, Year, Hour, Minute, Second, Request#request.method, Path, Query, Code]).
content_type(Filename) -> content_type(Filename) ->
@ -145,7 +145,7 @@ loop(Filename) ->
receive receive
reopenlog -> reopenlog ->
case ets:lookup(mod_http_fileserver, accessfile) of case ets:lookup(mod_http_fileserver, accessfile) of
undefined -> [] ->
ok; ok;
[{accessfile, AccessFile}] -> [{accessfile, AccessFile}] ->
file:close(AccessFile), file:close(AccessFile),
@ -198,7 +198,7 @@ stop(_Host) ->
ok; ok;
_ -> _ ->
case ets:lookup(mod_http_fileserver, accessfile) of case ets:lookup(mod_http_fileserver, accessfile) of
undefined -> [] ->
ok; ok;
[{accessfile, AccessFile}] -> [{accessfile, AccessFile}] ->
mod_http_fileserver_server ! stop, mod_http_fileserver_server ! stop,