I use a handrolled system which works very well for my application. I talked about it a bit at Catching fork() with tied STDERR.

While I never did find a general solution for the type of problem I discussed there, it hasn't caused me any problems since I found the solution for Email::Valid (ie to stop it forking by installing Net::DNS).

Until this week I supported 4 levels of logging: die, warn, debug and info. $SIG{__DIE__}, $SIG{__WARN__} are caught to redirect appropriately. Logged messages are split by installation (there are about 50 installations of the application running on the main box), and within an installation 'info' messages go to one file, and all others are split to files named after the program that generated them.

A cron job sends me a nightly email of any nonempty non-info files - the idea is that any problems logged are resolved and then the log lines relating to the problem cleared down, so that most of the time nothing is listed.

There is a single utility (called 'log') that makes it all useful: it allows me to list the log files, search for log lines matching particular patterns, clear down matching log lines, or tail selected groups of log files. (I got help with the tail problem at nonblocking I/O - testing whether file has more data to read - it now happily tails 80-odd files with good responsiveness at a processor load of around 0.07.)

This week I added a new type of log - spammers were regularly coming along to try and find holes in our mailform script, and we wanted a more automated process for handling them that didn't keep generating error logs. So I added an 'abuse' type, logged to a single per-installation file (like info), and a mechanism to block abusers for escalating periods of time.

Hugo


In reply to Re: Rolling your own die/carp/croak/logging/exception facility by hv
in thread Rolling your own die/carp/croak/logging/exception facility by eyepopslikeamosquito

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.