|
Hello, I have been using Lager for several months now to much success. One thing that I have not figured out though is how to get our output to match that of what the limited documentation claims. According to the blog post: http://basho.com/blog/technical/2011/07/20/Introducing-Lager-A-New-Logging-Framework-for-ErlangOTP/ It states: Now, those were messages coming out of error_logger, which is fine for legacy or library code, but Lager also has its own logging API that you can use. It's actually implemented via a parse_transform so that Lager can capture the current module, function, line number and pid for inclusion in the log message. All this is done automatically, and the logging call in the code looks like this: lager:error("oh no!")
lager:warning("~s, ~s and ~s, oh my!", [lions, tigers, bears])
Which will be displayed like: 2011-07-19 18:02:02 [error] <0.31.0>@test2:start:8 oh no!
2011-07-19 18:02:02 [warning] <0.31.0>@test2:start:9 lions, tigers and bears, oh my!
Note that you can easily see where the error occurred just by glancing at the line. Also notice that you don't need to stick a newline on the end of the log message. Lager automatically (and happily) does that for you. Unfortunately, I have never been able to get the <PID>@module:function:line format. Here is my output:00:04:45.504 [info] Riak socket link started <0.88.0> 00:04:45.513 [info] Starting <0.90.0> 00:04:45.514 [info] Riak socket link started <0.91.0> 00:04:45.520 [info] Starting <0.93.0> 00:04:45.520 [info] Riak socket link started <0.94.0> 00:04:45.527 [info] Pid1 = {ok,<0.63.0>} 00:04:45.530 [debug] next_worker: <0.64.0> 00:04:45.532 [debug] {new, file, <<"data/2012-03-31/test.data">>, <data-not-shown>} What am I doing wrong?
Thanks, Bryan |
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
