Skip Menu |

This queue is for tickets about the Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 82923
Status: new
Priority: 0/
Queue: Log-Log4perl

People
Owner: Nobody in particular
Requestors: cwilson [...] meadow.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.40
Fixed in: (no value)



Subject: Final flush / close not getting called on appenders
When using a Appender::Limit combined with a Log::Dispatch::Email appender to limit the qty of emails sent in a particular time period, the last message logged does not get emailed. I have reproduced this with Log4perl-1.40 under Linux. This sample script reproduces the problem: #!/usr/bin/env perl use Log::Log4perl qw(get_logger :levels :nowarn); use strict; my $conf = q( log4perl.category.ME = DEBUG, Limiter log4perl.filter.MatchError = Log::Log4perl::Filter::LevelMatch log4perl.filter.MatchError.LevelToMatch = ERROR log4perl.filter.MatchError.AcceptOnMatch = true # Email appender log4perl.appender.Mailer = Log::Dispatch::Email::MailSend log4perl.appender.Mailer.to = put.your.email@here.ok log4perl.appender.Mailer.subject = sub { "ME ALERT, $<" }; log4perl.appender.Mailer.buffered = 1 log4perl.appender.Mailer.layout = PatternLayout log4perl.appender.Mailer.layout.ConversionPattern=%d %m %n # Limiting appender, using the email appender above log4perl.appender.Limiter = Log::Log4perl::Appender::Limit log4perl.appender.Limiter.Filter = MatchError log4perl.appender.Limiter.appender = Mailer log4perl.appender.Limiter.block_period = 3 log4perl.appender.Limiter.appender_method_on_flush = flush ); Log::Log4perl::init(\$conf); my $logger = get_logger("ME"); $logger->level($DEBUG); $logger->error("test this."); $logger->error("and test this."); sleep 4; print "mail sent?\n"; $logger->error("TEST this."); $logger->error("2 TEST this."); sleep 4; print "mail sent?\n"; $logger->error("3 TEST this."); # this will never get emailed. $logger->error("4 TEST this.");