wellsja has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I was wondering if anyone has used log4perl to monitor apache from an internal perspective. Has anyone integrated log4perl into the logging mechinism of apache or just general monitoring of apache within the httpd.conf file probably using mod_perl ?

Thanks in advance

James

Replies are listed 'Best First'.
Re: log4perl and apache
by DaveH (Monk) on Oct 18, 2004 at 18:00 UTC

    Hi,

    I have used Log4perl with Apache using mod_perl before, and it works well provided you bear a few points in mind. One thing which you need to be careful of is file locking (flock and the like): make sure you consider deadlocks carefully (I had an indecipherable problem with using Log::Dispatch's Log::Dispatch::File::Rolling appender with my Log4perl configuration with mod_perl on Win32 (Win32 -- 'nuff said???) which I never really got to the bottom of. That was almost a year ago though, so don't let me put you off: I haven't tried this combination again recently with newer versions).

    Also, you now have Log::Log4perl::Appender::Synchronized, which uses IPC to synchronize access to the files, so this should alleviate some of the problems which I encountered. Also, please note the Log4perl FAQs on this subject; specifically "How can I synchronize access to an appender?" "How can I run Log::Log4perl under mod_perl?".

    As long as you are careful, Log4perl is an extremely rewarding way to develop web based applications, which has certainly reduced my development effort on the projects where I used it.

    Don't be afraid to take the Log4perl plunge if you are still debating whether to use it: it is a really nice piece of software which will really help your development if used properly.

    I hope that this helps.

    Cheers,

    -- Dave :-)


    $q=[split+qr,,,q,~swmi,.$,],+s.$.Em~w^,,.,s,.,$&&$$q[pos],eg,print
Re: log4perl and apache
by perrin (Chancellor) on Oct 18, 2004 at 15:37 UTC
    I'm not quite sure what you're after here. There is a complete mod_perl logging API and log4perl works fine with mod_perl. Anything beyond that would be specific to your application.