From: Peter M. <pe...@ao...> - 2009-03-24 14:19:36
|
Hello, I've encountered a problem with Log::Dispatch::FileRotate when running multiple processes sharing the same log. My script to reproduce are below. The script simply log the date every second and rotate every 5 seconds (this issue exists for daily rotation, too, which is how I first noticed it). It works fine if you run a single process, but then as soon as a launch another "nolog.pl" instance the existing logfiles are deleted except for the one with the largest number, and no more rotation happens. This issue exists on win xp and server 2003, activeperl 5.8.8, log4perl 1.15, FileRotate.pm version 1.15, and also FileRotate.pm version 1.19. The issue DOES NOT exist on linux (debian etch) perl 5.8.8, log4perl 1.07, FileRotate.pm 1.19. Any help you can provide in resolving this would be greatly appreciated. -Peter #! /usr/bin/perl -w # nolog.pl use strict; use warnings; use Log::Log4perl qw(:levels get_logger); Log::Log4perl->init_and_watch('log4perl.conf', 30); my $log = get_logger('root'); $log->info("init"); while (1) { $log->info(gmtime); sleep(1); } $log->info("never here"); # log4perl.conf log4perl.logger.root = TRACE,log1,console # output to stderr log4perl.appender.console = Log::Log4perl::Appender::Screen log4perl.appender.console.stderr = 1 log4perl.appender.console.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.console.layout.ConversionPattern = %d %c - %p - %m%n log4perl.appender.console.Threshold = INFO # output to log file log4perl.appender.log1 = Log::Dispatch::FileRotate log4perl.appender.log1.filename = logs/log1.txt log4perl.appender.log1.mode = append log4perl.appender.log1.min_level = info log4perl.appender.log1.max = 5 log4perl.appender.log1.DatePattern = 0:0:0:0:0:0:5 log4perl.appender.log1.TZ = EDT log4perl.appender.log1.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.log1.layout.ConversionPattern = %d %c - %p - %m%n |