Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: What module do you like for debugging CGI scripts - Log::Dispatch

by imp (Priest)
on Jan 27, 2007 at 15:28 UTC ( #596878=note: print w/replies, xml ) Need Help??

in reply to What module do you like for debugging CGI scripts

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 :)

  • Comment on Re: What module do you like for debugging CGI scripts - Log::Dispatch

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://596878]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2018-06-19 02:09 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.