log4perl icon indicating copy to clipboard operation
log4perl copied to clipboard

:no_extra_logdie_message should respect $EXCEPTIONS_BEING_CAUGHT

Open Sadrak opened this issue 2 years ago • 0 comments

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?

Sadrak avatar Aug 31 '23 11:08 Sadrak