Open sblondeel opened 2 years ago
Note: this bug is also triggered by the WARN level.
I've cut the example (which does indeed behave in the way described) down to this:
use strict;
use warnings;
use Log::Log4perl qw(get_logger);
print STDERR "\$PERL_VERSION: $^V\n";
print STDERR "\$Log::Log4perl::VERSION=$Log::Log4perl::VERSION\n";
my $USER = $ENV{'USER'};
Log::Log4perl->init(\<<"EOCONF");
log4perl.logger=DEBUG, mail
log4perl.appender.mail=Log::Dispatch::Email::MailSend
log4perl.appender.mail.to=$USER\@localhost
log4perl.appender.mail.layout=Log::Log4perl::Layout::PatternLayout
EOCONF
my $logger = get_logger(q{});
$logger->error_die('FATAL ERROR');
sub unused_function {
inexistent_function($logger);
}
Would it work, in your application, to have a "weak reference" $logger_weak
in the function, which would only call the other function if that variable was still defined? This seems like more of a thing to document, since the reference being held by that function is otherwise an insoluble problem. An alternative would be to just do get_logger()
each time?
Hello,
Given the following script, which I tried to keep minimal:
My problem is the following:
I tested it on various configurations:
Debian 10
CentOS 7
Note: for CentOS 7 I added "use Carp; carp 'backtrace: ';" in /usr/share/perl5/vendor_perl/Mail/Send.pm to try to see what happens. Other system modules may have their line numbers slightly off because I added some logging there and there (which I removed in the above copy-paste).
Without this call to carp (which may trigger this Carp bug fixed as of 1.47_01: https://metacpan.org/release/XSAWYERX/Carp-1.50/source/lib/Carp.pm; see the following comment starting line 330:
), I still get: