fritz1968 has asked for the wisdom of the Perl Monks concerning the following question:
Hello
I am trying to setup a logging using log4perl where the filename can be set dynamically. Of course I am having troubles. Here is my current code:
my $logFile="$logDir/$logfileName"; $logConf = q( log4perl.category.Foo.Bar = INFO, Logfile, Screen log4perl.appender.Logfile = log::Log4perl::Appender::File log4perl.appender.Logfile.filename = logs/frank.txt log4perl.appender.Logfile.layout = Log::Log4perl::Layou +t::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d + %-25M %X{logref} %p %m %n log4perl.appender.Screen = Log::Log4perl::Appende +r::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = Log::Log4perl::Layout:: +SimpleLayout ); Log::Log4perl->init(\$logConf);
The problem is that I don't want each file name to be named "logs/frank.txt". I would rather have something like:
logs/frank.<date>.txt
Any help would be greatly appreciated.
Thanks,
Frank
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: log4Perl dynamic filename
by stefbv (Curate) on May 16, 2013 at 12:46 UTC | |
Re: log4Perl dynamic filename
by Anonymous Monk on May 16, 2013 at 13:23 UTC | |
Re: log4Perl dynamic filename
by dd-b (Monk) on May 16, 2013 at 22:47 UTC | |
by Anonymous Monk on May 17, 2013 at 13:58 UTC | |
Re: log4Perl dynamic filename
by periapt (Hermit) on May 20, 2013 at 12:24 UTC |
Back to
Seekers of Perl Wisdom