chanakya has asked for the wisdom of the Perl Monks concerning the following question:
Thank you for your time.#!/usr/bin/perl use strict; use warnings; use Log::Dispatch; use Log::Dispatch::FileRotate; use Date::Format; my @loc = localtime(); my $current_date = Date::Format::strftime("%Y%m%d", @loc); my $logfile = "app.".$current_date.".log"; our $HOSTNAME = `hostname`; chomp $HOSTNAME; my $log = new Log::Dispatch( callbacks => sub { my %h=@_; return $HOSTNAME." $0 \[$$]: ".$h{m +essage}."\n"; } ); $log->add( Log::Dispatch::FileRotate->new( name => 'file1', min_level => 'info', mode => 'append', filename => File::Spec->catfile( +$log_dir, $logfile), DatePattern => 'yyyy-mm-dd', ) ); $log->info("Starting Processing: ".localtime());
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Rotation issue with Log::Dispatch::FileRotate
by happy.barney (Friar) on Nov 16, 2009 at 11:32 UTC |