You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Anthony Ananich <an...@inpun.com> on 2013/03/01 00:05:42 UTC

Re: Custom log format

Found answer in couch_log.erl

get_log_messages(Pid, Level, Format, Args) ->
    ConsoleMsg = unicode:characters_to_binary(io_lib:format(
        "[~s] [~p] " ++ Format ++ "~n", [Level, Pid | Args])),
    FileMsg = ["[", couch_util:rfc1123_date(), "] ", ConsoleMsg],
    {ConsoleMsg, iolist_to_binary(FileMsg)}.

So FileMsg is hardcoded.

On Fri, Mar 1, 2013 at 1:16 AM, Anthony Ananich <an...@inpun.com> wrote:
> Hi!
>
> I wonder if it is possible to change couch.log file format to Apache's
> log file format?
>
> I need this to be able to use log file analyzer tools like AWStats.
>
> I found that handle_log_req could be customized, but I guess that it
> just reads log file and send it's part over HTTP.
>
> Thanks,
> Anthony

Re: Custom log format

Posted by Henri van den Bulk <hv...@gmail.com>.
Would be nice to keep this consistent with apache http. You can make it put out in multiple formats. 

http://httpd.apache.org/docs/2.2/mod/mod_log_config.html

Thanks,

Henri van den Bulk

On Feb 28, 2013, at 4:09 PM, Lance Carlson <la...@gmail.com> wrote:

> I wonder if this could be turned into a config setting or something.
> I'd just worry about the overhead of having the load the format.
> Though the log format could be cached on boot.
> 
> Sent from my iPhone
> 
> On Feb 28, 2013, at 6:06 PM, Anthony Ananich <an...@inpun.com> wrote:
> 
>> Found answer in couch_log.erl
>> 
>> get_log_messages(Pid, Level, Format, Args) ->
>>   ConsoleMsg = unicode:characters_to_binary(io_lib:format(
>>       "[~s] [~p] " ++ Format ++ "~n", [Level, Pid | Args])),
>>   FileMsg = ["[", couch_util:rfc1123_date(), "] ", ConsoleMsg],
>>   {ConsoleMsg, iolist_to_binary(FileMsg)}.
>> 
>> So FileMsg is hardcoded.
>> 
>> On Fri, Mar 1, 2013 at 1:16 AM, Anthony Ananich <an...@inpun.com> wrote:
>>> Hi!
>>> 
>>> I wonder if it is possible to change couch.log file format to Apache's
>>> log file format?
>>> 
>>> I need this to be able to use log file analyzer tools like AWStats.
>>> 
>>> I found that handle_log_req could be customized, but I guess that it
>>> just reads log file and send it's part over HTTP.
>>> 
>>> Thanks,
>>> Anthony

Re: Custom log format

Posted by Lance Carlson <la...@gmail.com>.
I wonder if this could be turned into a config setting or something.
I'd just worry about the overhead of having the load the format.
Though the log format could be cached on boot.

Sent from my iPhone

On Feb 28, 2013, at 6:06 PM, Anthony Ananich <an...@inpun.com> wrote:

> Found answer in couch_log.erl
>
> get_log_messages(Pid, Level, Format, Args) ->
>    ConsoleMsg = unicode:characters_to_binary(io_lib:format(
>        "[~s] [~p] " ++ Format ++ "~n", [Level, Pid | Args])),
>    FileMsg = ["[", couch_util:rfc1123_date(), "] ", ConsoleMsg],
>    {ConsoleMsg, iolist_to_binary(FileMsg)}.
>
> So FileMsg is hardcoded.
>
> On Fri, Mar 1, 2013 at 1:16 AM, Anthony Ananich <an...@inpun.com> wrote:
>> Hi!
>>
>> I wonder if it is possible to change couch.log file format to Apache's
>> log file format?
>>
>> I need this to be able to use log file analyzer tools like AWStats.
>>
>> I found that handle_log_req could be customized, but I guess that it
>> just reads log file and send it's part over HTTP.
>>
>> Thanks,
>> Anthony