in reply to Log4perl modifying filename
What do you have against putting perl code in your config?
You know that you can keep your config in a string, modify it in the usual way, and then pass that string into Log::Log4perl::init. Something like this (from one of my scripts)
my $log4perlConf = q( log4perl.appender.scriptName.filename=__PLACEHOLDER__ log4perl.appender.scriptName.layout=Log::Log4perl::Layout::Pattern +Layout log4perl.logger = INFO, scriptName ); $log4perlConf =~ s/__PLACEHOLDER__/$logFileName/; Log::Log4perl::init(\$log4perlConf);
I don't think this approach will let you change the output file on the fly, though depending on what you are trying to do, you could also look into: Log::Dispatch::FileRotate which rotates the log file daily, weekly or whatever you like.
|
|---|