[erlang-questions] [ANN] Lager - a new logging framework for Erlang/OTP

Tim Watson watson.timothy@REDACTED
Thu Jul 21 22:01:36 CEST 2011


On 21 July 2011 06:53, Max Lapshin <max.lapshin@REDACTED> wrote:
> And, Andrew.
> Log rotation is the _most_ important feature in any logger. In fact,
> any logging system must be started from log rotator, because as a rule
> of thumb, it should be considered, that nobody ever setups logrotate.

Yes, that's why https://github.com/hyperthunk/fastlog uses
error_logger by default, which can benefit from sasl rolling log
configuration and riak_err to minimise memory usage.

Andrew - I find it interesting that you did the opposite, and
optionally redirected error_logger to Lager! :)

I like the way you check the levels though -
https://github.com/basho/lager/blob/master/src/lager_console_backend.erl#L42
- this is cleaner than the boilerplate I ended up with in fastlog,
which checks the atoms for all the possible levels. I might steal
that. :)

Do you support (or plan to support) named loggers? This is a useful
feature, as well as the ability to set different levels for different
(named) logger processes, which I use quite often.

I notice in your parse_transform that you log a bunch of useful stuff.
I did something similar (see
https://github.com/hyperthunk/fastlog/wiki/Parse-Transform-Support for
details) although I allow patterns to be defined (per logger) to
specify which bits actually appear in the logs - again something you
might like to think about.

Also in your parse_transform, you seem to log time information by
default - this can be quite expensive and it might be better to make
this optional!?

One final note - lager_mochiglobal appears to be doing some scary
things. Is this really the easiest way to check whether or not a log
level is set properly, and why do you need to check the level at the
call site if the logging process (i.e., the gen_event handler) is also
doing this? Maybe I've flicked thorugh the code too quickly and
misunderstood.

Anyway - hope these comments are helpful, and thanks for the
contribution to the community. We have at least 4 logging frameworks
to choose from now! :)



More information about the erlang-questions mailing list