I have Log4perl installed on my Linux machine and have the following /path/to/log4perl.conf
:
log4perl.logger.Fizz = INFO, FizzAppender
log4perl.logger.Buzz = INFO, BuzzAppender
log4perl.appender.FizzAppender = Log::Dispatch::FileRotate
log4perl.appender.FizzAppender.filename = /my/logs/fizz-log.txt
log4perl.appender.FizzAppender.max = 1
log4perl.appender.FizzAppender.DatePattern = yyyy-MM-dd
log4perl.appender.FizzAppender.TZ = EST
log4perl.appender.FizzAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.FizzAppender.layout.ConversionPattern = %d %m %n
log4perl.appender.BuzzAppender = Log::Dispatch::FileRotate
log4perl.appender.BuzzAppender.filename = /my/logs/buzz-log.txt
log4perl.appender.BuzzAppender.max = 1
log4perl.appender.BuzzAppender.DatePattern = yyyy-MM-dd
log4perl.appender.BuzzAppender.TZ = EST
log4perl.appender.BuzzAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.BuzzAppender.layout.ConversionPattern = %d %m %n
Inside each of my perl scripts (each script uses a different appender and a logs to a different log file):
use Log::Log4perl;
my $log_conf = "/path/to/log4perl.conf";
Log::Log4perl::init($log_conf);
# In one script the logger is a "Fizz" logger (like below), and in the other
# script the logger is a "Buzz" logger.
my $logger = Log::Log4perl->get_logger("Fizz");
$logger->info("This should work.");
Even though each script uses a different appender and logs to a different file, they should all have the same behavior:
- Each log gets rotated once a day, and old (rotated) logs gets deleted
I've had this script running for more than 24 hours now, and I don't see any logs being generated under /my/logs/
.
So I ask: is my log4perl.conf
incorrect? If not, what can I do to diagnose the issue? Am I initializing the library incorrectly in the perl scripts? Thanks in advance.