From fb9268417bfd9e39f50053e948291c77530609a1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Apr 2020 16:12:32 +0200 Subject: [PATCH] Bug 25172: Remove _recheck_logfile I don't understand how that could be useful. We do not want to test if the logfile is writable every time we log something! Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize --- Koha/Logger.pm | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/Koha/Logger.pm b/Koha/Logger.pm index 22f5fb6df6..2751bf189b 100644 --- a/Koha/Logger.pm +++ b/Koha/Logger.pm @@ -86,17 +86,8 @@ sub AUTOLOAD { my $method = $Koha::Logger::AUTOLOAD; $method =~ s/^Koha::Logger:://; - if ( !exists $self->{logger} ) { - - #do not use log4perl; no print to stderr - } - elsif ( !$self->_recheck_logfile ) { - warn "Log file not writable for log4perl"; - warn "$method: $line" if $line; - } - elsif ( $self->{logger}->can($method) ) { #use log4perl - $self->{logger}->$method($line); - return 1; + if ( $self->{logger}->can($method) ) { #use log4perl + return $self->{logger}->$method($line); } else { # we should not really get here warn "ERROR: Unsupported method $method"; @@ -112,7 +103,7 @@ sub AUTOLOAD { sub DESTROY { } -=head2 _init, _recheck_logfile +=head2 _init =cut @@ -132,20 +123,6 @@ sub _init { return Log::Log4perl->init_once($log4perl_config); } -sub _recheck_logfile { # recheck saved logfile when logging message - my $self = shift; - - return 1 if !exists $self->{logs}; # remember? your own responsibility - my $opac = $self->{cat} =~ /^OPAC/; - my $log; - foreach ( @{ $self->{logs} } ) { - $log = $_ if $opac && /^OPAC:/ || !$opac && /^INTRANET:/; - last if $log; - } - $log =~ s/^(OPAC|INTRANET)://; - return -w $log; -} - =head2 debug_to_screen Adds a new appender for the given logger that will log all DEBUG-and-higher messages to stderr. -- 2.39.5