mschilli / log4perl

Log4j Implementation For Perl
http://log4perl.com
Other
116 stars 66 forks source link

:no_extra_logdie_message should respect $EXCEPTIONS_BEING_CAUGHT #127

Open Sadrak opened 10 months ago

Sadrak commented 10 months ago

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?