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

Hi All,

I am implementing a logging framework for a project. Here my requirement is that, the log has to get rotate automatically for each 5 minutes.

As I knew we have several CPAN Modules for implement logging mechanism.

Like:
Log::Log4perl Log::Dispatch Log::Dispatch::File::Rolling Log::Dispatch::FileRotate
But I am not sure that which of the above will suitable for my requirements.

Is anyone used any of these for such requirements if so, please suggest me that which one will be proper and sure, among above all.

Replies are listed 'Best First'.
Re: CPAN Module for logging framework
by blue_cowdawg (Monsignor) on Aug 24, 2011 at 13:35 UTC
        Is anyone used any of these for such requirements if so, please suggest me that which one will be proper and sure, among above all.

    Suggest you take a closer look at Log::Dispatcher::FileRoate. This module has the notion of rotating files on a date/time basis as well as a size basis.

    Is your logging volume really large enough to justify five minute rotations? Seems a bit excessive to me...


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: CPAN Module for logging framework
by ctilmes (Vicar) on Aug 24, 2011 at 13:47 UTC
    Consider using 'logrotate'. It may be available already for your platform (or is easy to install if it isn't). It has very flexible log rotating mechanisms you can use across your Perl and non-Perl applications.

    You'll still need a good CPAN logging module to create the log in the first place.

Re: CPAN Module for logging framework
by Marshall (Canon) on Aug 24, 2011 at 16:43 UTC
    I am quite astonished if you mean that you need to start a new log file every 5 minutes! WOW!

    How many log entries do you expect during this 5 minute window?
    What is the average number of entries in 5 minutes?
    What is the size of a typical log entry (in bytes)?
    What happens to the log file that is 15 minutes old?
    How often do you process these log files?
    How complex is that analysis of the log file?

    You are describing an unusual performance requirement. That is fine, but please add some more details about it.

    I am not sure that which of the above will suitable for my requirements.
    I don't understand your requirements. The answers to the questions above could lead me to very different recommendations for implementation.
Re: CPAN Module for logging framework
by duyet (Friar) on Aug 24, 2011 at 16:23 UTC
    If you are on the Unix/Linux system, you might want to have a look at cronolog