Hello,

I did an update on my Lager deps and am now experiencing some formatting issues with error_log:error_report(Report). Here is my code in my mochiweb loop:

    try
        ...
    catch
        Type:What ->
            Report = ["web request failed",
                      {method, Req:get(method)},
                      {path, Path},
                      {type, Type},
                      {what, What},
                      {trace, erlang:get_stacktrace()},
                      {request, Req}],
            error_logger:error_report(Report),
            ...
    end.

And this is what is printed to the console log (truncated for readability) - the issue is that now, the lists are being printed as lists:

14:52:47.685 [error] [119,101,98,32,114,101,113,117,101,115,116,32,102,97,105,108,101,100], method: 'POST', path: [115,101,115,115,105,111,110], type: error, what: function_clause, trace: [{'mochijson2','-json_encode_proplist/2-fun-0-', <snip>

It used to print correctly.

I did a little more investigating and discovered that if you call error_report with just a string, you get the correct formatting:

1> error_logger:error_report(["Hello World"]).
ok
15:09:09.640 [error] Hello World

Now, if you add in a term:

1> error_logger:error_report(["Hello world!",{method, foo}]).
ok
15:12:15.297 [error] [72,101,108,108,111,32,119,111,114,108,100,33], method: foo

The string is now a literal list and not human readable.

Now, if I use the native error_logger without Lager:

2> error_logger:error_report(["Hello world"]).

=ERROR REPORT==== 5-Nov-2011::15:14:35 ===
Hello world
ok
3> error_logger:error_report(["Hello world", {method, foo}]).
ok
4>
=ERROR REPORT==== 5-Nov-2011::15:14:44 ===
    "Hello world"
    method: foo

Which does the correct thing.

Cheers,
Bryan





_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to