Hi all,

I'm working on rotating log files and am using the logfile::rotate
module.  What I need to do is add the date to the file name that is
being created.  Would I use the post function and move the file and
append it to the file?  If so could you proved an example?

Thanks,
Tim


#!/usr/bin/perl -w

use strict;
use Logfile::Rotate;
my $logfile;

my $date;
my ($sec,$min,$hour,$mday,$mon,$year) = (localtime) [0,1,2,3,4,5];
$year=$year+1900;
$mon=$mon+1;
$date = sprintf("%02d%02d%02d\_%02d\:%02d\:%02d", $year,$mon,$mday,
$hour,$min,$sec); 

$logfile = new Logfile::Rotate(
        File    => "/home/twolak/dogs",
        Count   => 5,
        Gzip    => "/bin/gzip",
                );

$logfile->rotate();
undef $logfile;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to