I am using Log::Dispatch::FileRotate 1.11 and Log4perl 0.50. A log file is produced and messages are being logged. However, the file is not being rotated. Here is what is in the config file for the rotating appender:
log4perl.appender.Roll1=Log::Dispatch::FileRotate log4perl.appender.Roll1.filename=test.log log4perl.appender.Roll1.max=3 log4perl.appender.Roll1.name=test log4perl.appender.Roll1.DatePattern=yyyy-MM-DD log4perl.appender.Roll1.mode=append log4perl.appender.Roll1.TZ=GMT log4perl.appender.Roll1.layout=Log::Log4perl::Layout::PatternLayout log4perl.appender.Roll1.layout.ConversionPattern=%d {ISO8601} %p [%C] %m%n
Can anyone help? TIA!
You're using yyyy-MM-DD as a date pattern, but the Log::Dispatch::FileRotate man page says:
... yyyy-MM-dd every day ...
Sorry, that was a typo in my post. I have yyyy-MM-dd in my configuration file. In fact, I changed it to yyyy-MM-dd-HH-MM and it still doesn't work.
I also have the following in my config file: log4perl.category= DEBUG, Roll1
Try this:
use Log::Log4perl qw(:easy);
Log::Log4perl->init( \ q{ log4perl.category = DEBUG, Logfile log4perl.appender.Logfile = Log::Dispatch::FileRotate log4perl.appender.Logfile.filename = test.log log4perl.appender.Logfile.mode = append log4perl.appender.Logfile.max = 5 log4perl.appender.Logfile.DatePattern = yyyy-MM-dd-HH-mm log4perl.appender.Logfile.TZ = PST log4perl.appender.Logfile.layout = \ Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d %m %n });
DEBUG "foo";
Log in to post a comment.
I am using Log::Dispatch::FileRotate 1.11 and Log4perl 0.50. A log file is produced and messages are being logged. However, the file is not being rotated. Here is what is in the config file for the rotating appender:
log4perl.appender.Roll1=Log::Dispatch::FileRotate
log4perl.appender.Roll1.filename=test.log
log4perl.appender.Roll1.max=3
log4perl.appender.Roll1.name=test
log4perl.appender.Roll1.DatePattern=yyyy-MM-DD
log4perl.appender.Roll1.mode=append
log4perl.appender.Roll1.TZ=GMT
log4perl.appender.Roll1.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.Roll1.layout.ConversionPattern=%d {ISO8601} %p [%C] %m%n
Can anyone help? TIA!
You're using yyyy-MM-DD as a date pattern, but the Log::Dispatch::FileRotate man page says:
...
yyyy-MM-dd every day
...
Sorry, that was a typo in my post. I have yyyy-MM-dd in my configuration file. In fact, I changed it to yyyy-MM-dd-HH-MM and it still doesn't work.
I also have the following in my config file:
log4perl.category= DEBUG, Roll1
Try this:
use Log::Log4perl qw(:easy);
Log::Log4perl->init( \ q{
log4perl.category = DEBUG, Logfile
log4perl.appender.Logfile = Log::Dispatch::FileRotate
log4perl.appender.Logfile.filename = test.log
log4perl.appender.Logfile.mode = append
log4perl.appender.Logfile.max = 5
log4perl.appender.Logfile.DatePattern = yyyy-MM-dd-HH-mm
log4perl.appender.Logfile.TZ = PST
log4perl.appender.Logfile.layout = \ Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logfile.layout.ConversionPattern = %d %m %n
});
DEBUG "foo";