in reply to [SOLVED] Log::Log4perl and Log::Dispatch::FileRotate: Issues rotating log files based on date pattern

The easiest way to rotate the log every day is to use Re: log4Perl dynamic filename its FAQ
log4perl.appender.Logfile.filename = sub { my $date = POSIX::strftime('%Y-%m-%d', localtime ); return "myapp-$date.log"; };
  • Comment on Re: Log::Log4perl and Log::Dispatch::FileRotate: Issues rotating log files based on date pattern (rotate log every day)
  • Download Code

Replies are listed 'Best First'.
Re^2: Log::Log4perl and Log::Dispatch::FileRotate: Issues rotating log files based on date pattern (rotate log every day)
by ateague (Monk) on Jan 30, 2015 at 17:54 UTC

    Thanks.

    That certainly will create new log files every day but, the downside to that approach is that it will not *rotate* the log files after a certain number of days (8 in my case)