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?


In reply to Choosing logging module by dgaramond2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.