and modify the cron job to reflect that:my $log_method = sub { my ($level,$msg) = @_; my $DBG_MAP = { 0 => $INFO, 1 => $WARN, 2 => $ERROR }; my $conf = q( log4perl.category.appname = INFO, Logfile log4perl.appender.Logfile = Log::Log4perl::Ap +pender::File log4perl.appender.Logfile.filename = /usr/local/eFTP/l +ogs/appname.pl.log log4perl.appender.Logfile.layout = \ Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = % +d %F{1} %L> %m %n ); Log::Log4perl::init(\$conf); my $logger = Log::Log4Perl->get_logger("appname"); $logger->log($DBG_MAP->{$level},$msg); };
I also removed the call to my Log(..) subroutine in TestSub, since it's redefined and used here in $log_method.my $cron = new Schedule::Cron(\&dispatcher, nofork => 1, #log => \&Log, log => $log_method, ); $cron->add_entry("* * * * *", {'subroutine' => \&TestSub(), 'arguments' => [ "INFO", "a test" ], } );
Again, now there's nothing logged to the file at all. The file /tmp/testfile is updated, so I know TestSub ran, but nothing updated in appname.pl.log, and no Schedule::Cron process in the process table after a couple minutes.
Is there something I'm not setting the Schedule::Cron object? What else could be causing not to log at all, much less quit?
-- Burvil
In reply to Re^2: Log4perl script logs OK only initially
by bowei_99
in thread Log4perl script logs OK only initially
by bowei_99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |