From: Robert J. <yad...@sn...> - 2007-02-15 19:55:16
|
At 07:53 AM 2/15/2007, Dirk Vleugels wrote: >Hi, > >is there a easy way to give the rotated files a different suffix? >Currently a rotated file will be named: > >example.log -> example.log.1 > >but i need something like: > >example.log.YYYYMMDDHH > >Maybe by defining a callback? I can't find anything in the docs ... Well, Log::Dispatch::FileRotate isn't part of Log::Log4perl, but I can answer anyway :) I took a look at the source code for FileRotate.pm -- and the renaming scheme is hard-coded: sub log_message { #[...] while($idx >= 0) { if($idx <= 0) { warn "$$ rename $name $name.1\n" if $self->{debug}; rename($name, "$name.1"); } else { warn "$$ rename $name.$idx $name.".($idx+1)."\n" if $self->{debug}; rename("$name.$idx", "$name.".($idx+1)); } $idx--; } # [...] Therefore, you need to subclass and override the log_message() method in order to get the name change you want. Do you know how to do that? I'm not an expert, but I've done something similar before with other modules. HTH, Rob -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Robert Jacobson .......................... Flight Ops. Team Solar Dynamics Observatory (SDO) ............. .............. |