log4perl
log4perl copied to clipboard
:no_extra_logdie_message should respect $EXCEPTIONS_BEING_CAUGHT
We are playing with try-catch and logdie() and hit some problems.
use Log::Log4perl qw(:no_extra_logdie_message);
is bad implemented, due to the use of exit() you can't fetch the error anymore. So activating this flag will lead in a total change in behavior (not only suppress some logging).
Playing with $EXCEPTIONS_BEING_CAUGHT or $^S it is possible to throw the exception via die().
Something like that:
if (not $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR and $^S) {
$self->and_die(@_); # or confess/croak
}
in the beginning of error_die(), logdie(), logconfess() and logcroak() solve this for us. But i am unsure where exactly this should be placed.
Or should this solved somewhere else?