Subject: | autoflush doesn't mean what it usually does |
Date: | Sat, 19 Apr 2008 15:51:26 +0100 |
To: | bug-Catalyst-Log-Log4perl [...] rt.cpan.org |
From: | David Wright <dave [...] dexy.org> |
Hi,
'autoflush' usually means that a write should happen immediately, and
not be buffered.
Catalyst::Log::Log4perl doesn't respect this, either when set using the
log4perl conf, or when using the option to new(). I know that the option
to new() doesn't say that it does do this, but rather disables 'abort'.
That I think is a misunderstanding in the meaning of 'autoflush'.
In order to get autoflush working as expected, I have had to create a
derived class and override _log():
sub _log {
my $self = shift;
$self->SUPER::_log(@_);
$self->_flush if scalar(caller(1)) =~ /^MyApp(::|$)/;
}
perl -v: v5.8.8 built for i486-linux-gnu-thread-multi
uname -a: Linux PC-5023452 2.6.22-14-generic #1 SMP Fri Feb 1 04:59:50
UTC 2008 i686 GNU/Linux
Catalyst::Log::Log4perl version: 1.0
Thanks,
David Wright