Logger

0 views
Skip to first unread message

David Michael

unread,
Sep 14, 2009, 9:35:01 AM9/14/09
to NYC:Erlang
Can anyone share their strategies for logging? Preferably something
that I can toggle on|off.
My GoogleFu is weak.

David

David Michael

unread,
Sep 15, 2009, 1:10:31 PM9/15/09
to NYC:Erlang
Seems there are a few loggers to choose from in the standard lib

http://erlang.mirror.su.se/doc/system_principles/error_logging.html
http://erlang.mirror.su.se/doc/apps/sasl/error_logging.html

also
http://code.google.com/p/log4erl/

Not sure which is the best choice....

Will Schenk

unread,
Sep 15, 2009, 2:33:53 PM9/15/09
to nyce...@googlegroups.com
The armstrong book talks about that I think. The disk_log module
looks pretty interesting if you are looking to roll your own, but I
don't know if there's the sort of log4j-type thing out there. Let us
know what you find...

David Michael

unread,
Sep 15, 2009, 2:55:42 PM9/15/09
to nyce...@googlegroups.com
Yeah, I was combing the Armstrong book (or was it the OReilly book)
and came up with very little... Ill check the Armstrong book again.

Morgan Craft

unread,
Sep 15, 2009, 2:58:11 PM9/15/09
to nyce...@googlegroups.com
apress has a book scheduled to come out at some point - though I checked the authors twitter the other week and it sounded like he just started.  Maybe someone should email him and tell him to talk about loggers =p

Mihai Balea

unread,
Sep 15, 2009, 3:07:49 PM9/15/09
to nyce...@googlegroups.com

On Sep 15, 2009, at 2:55 PM, David Michael wrote:

>
> Yeah, I was combing the Armstrong book (or was it the OReilly book)
> and came up with very little... Ill check the Armstrong book again.

The Armstrong book doesn't say much about logging.

The subject is somewhat delicate, because loggers sometimes act as
concurrency bottlenecks in a system.
Most people are content with the standard logger (error_logger module)
and with saving logs to a file and/or the console.
The SASL application adds a couple of different logger backends,
particularly one that saves log items to a buffered file as binary
erlang terms. This is probably the fastest you can get, but it will
require special tools to read and search.

Anyway, error_logger is just a gen_event instance so anybody can hook
up to it and redirect log items to any other target. Some people,
including myself have designed specific logger implementations based
on it, that do all sorts of log formatting and filtering. Log4erl is
one of the freely available implementations, I'm sure there are others.

Bottom line is I don't think there's a clear answer. It all depends on
your logging requirements.

Mihai

Matt Williamson

unread,
Sep 21, 2009, 1:38:32 PM9/21/09
to nyce...@googlegroups.com
I wrote a nice (well I think it's nice) rotating logger a while back. You can check it out here: http://github.com/dawsdesign/rotating_logger
Reply all
Reply to author
Forward
0 new messages