Bug 25172: Remove _recheck_logfile
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 16 Apr 2020 14:12:32 +0000 (16:12 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 22 Apr 2020 12:43:58 +0000 (13:43 +0100)
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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Logger.pm

index 22f5fb6..2751bf1 100644 (file)
@@ -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.