Don't ask to ask, just ask | |
PerlMonks |
Choosing logging moduleby dgaramond2 (Monk) |
on May 25, 2007 at 02:17 UTC ( [id://617382]=perlquestion: print w/replies, xml ) | Need Help?? |
dgaramond2 has asked for the wisdom of the Perl Monks concerning the following question: I've used Log::Log4perl for quite a while. It turns out that most of the time the :easy interface is all I'm using. Also, "multiple categories" is something I've wanted and haven't exactly found. Maybe it's time to try something else. Here's how I prefer to use the logging module: Pick a level using from one of the log statements (debug()/info()/warn()/error()/fatal()), give it zero or more "tags" (or "categories", or "keywords"), followed by the message. That's it. I don't want to have to explicitly create in every package a logger object with a certain category, or do any other unnecessary setup. Later, in a log file or the configuration section, I can configure which levels, which set of tags, and which package/subroutine pattern, should go to which output (stdout/stderr, file, etc). I want maximum level of flexibility in filtering log messages in output. Sometimes I want to stay at level warn() globally, but turn on debugging for only one or two subroutines which I'm interested in. Or, just shows debug() messages in a package which include the tag "dump", to let them dump data structures. Or maybe, in an SMTP server code, sometimes I want to temporarily turn on debugging for just a client IP/IP range, in Sundays, and then log all the DATA being sent by the client _if_ said mail body is larger than 20k and contain certain regex pattern. All this without modifying the source code, of course. Any recommendations?
Back to
Seekers of Perl Wisdom
|
|