The cleanup code introduced in 0.46 can lead to
problems in other programs DESTROY function, since the
logger is still alive, but can no longer be called. If
a OO-package has something like
...
my $log = get_logger;
...
sub DESTROY {
if ($log) {
$log->debug(...);
}
}
Depending on the destruction implementation of the
perl-version this can lead to warnings like:
Use of uninitialized value in subroutine entry at
/home/heikok/tmp/perl5/Log/Log4perl/Logger.pm line 689
during global destruction.
since $log->debug still can be called, while
$log->{is_debug} might have been cleaned up.
Possible solutions:
a) check for the existence of $log->{is_*} in the
construction of the $log->functions
b) why do you need to cleanup the hash-keys?
c) create a interface so that users can check if the
logger still is alive. I'm currently using:
if ($log && scalar keys %$log)
but this goes IMHO to deep into the $log package. a
$log->is_alive would be much nicer
I haven't been able to reconstruct this problem in a
small case since it depends to strongly on the order of
the garbage-collector of perl. I found this bug in the
SPOPS package (0.87) on CPAN.
Heiko