Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Log File

by daxim (Chaplain)
on Oct 15, 2012 at 07:58 UTC ( #999023=note: print w/replies, xml ) Need Help??

in reply to Log File

See How can I roll over my logfiles automatically at midnight? in Log::Log4perl::FAQ:
When using Log::Dispatch::FileRotate, all you have to do is specify it in your Log::Log4perl configuration file and your logfiles will be rotated automatically.

You can choose between rolling based on a maximum size ("roll if greater than 10 MB") or based on a date pattern ("roll everyday at midnight").

Replies are listed 'Best First'.
Re^2: Log File
by Anonymous Monk on Oct 15, 2012 at 09:29 UTC

    Reading the faq i see that module Log::Dispatch::FileRotate can help me. But I am nt able to know how to use it? I am giving the code i am using presently::

    open(LOG,">file.txt") some code print LOG,"message"; some code print LOG,"message"; close(LOG;)

    How can i implement the above code through Log::Dispatch::FileRotate to change filename if size exceeds 10 mb?

      First, install the module from CPAN. Second, declare use of the module in your code (see use) . Third, call the module (as described in the module FAQ) at the desired point in your existing code.

      Additional info about modules can be found here. If you still have questions, consider checking other parts of perlintro as well.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2018-03-23 03:17 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (287 votes). Check out past polls.