My preferred approach is to only log fairly important events by default, but to record the entire debug trail in a database when an error occurs. In production environments this approach avoids the usual problem of having either too much log output (filling the log file and wasting disk IO), or too little (unable to diagnose errors). It is also helpful to log the contents of %ENV and sometimes a dump of the current CGI params, but be careful not to record credit card numbers in a log file.
The best module for this that I have found is Log::Dispatch with Log::Dispatch::Buffer, but I'm sure you could do something similar with Log::Log4perl. You should always log things of notice level or higher to syslog in my opinion.
I designed this sytem for something that used CGI::Application and added a teardown task that handled the check for highest severity.
If your reason for asking for a logging system recommendation is that you are currently trying to track down a bug, then I very strongly recommend you break some of your supporting code into supporting modules and write a reasonable test suite for it. Once you start writing tests you'll never go back :)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.