Bugzilla – Attachment 103391 Details for
Bug 25172
Koha::Logger init is failing silently
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25172: Make Koha::Logger explode if init went wrong
Bug-25172-Make-KohaLogger-explode-if-init-went-wro.patch (text/plain), 3.08 KB, created by
Kyle M Hall (khall)
on 2020-04-21 16:28:22 UTC
(
hide
)
Description:
Bug 25172: Make Koha::Logger explode if init went wrong
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-04-21 16:28:22 UTC
Size:
3.08 KB
patch
obsolete
>From 83bb822a7d3b0a87ef7a1f9ff4e260f641c003a2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 16 Apr 2020 16:11:02 +0200 >Subject: [PATCH] Bug 25172: Make Koha::Logger explode if init went wrong > >We do not want to fail silently for the logger. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Logger.pm | 61 +++++++++++--------------------------------------- > 1 file changed, 13 insertions(+), 48 deletions(-) > >diff --git a/Koha/Logger.pm b/Koha/Logger.pm >index dbcbd7c303..22f5fb6df6 100644 >--- a/Koha/Logger.pm >+++ b/Koha/Logger.pm >@@ -112,59 +112,24 @@ sub AUTOLOAD { > > sub DESTROY { } > >-=head2 _init, _check_conf and _recheck_logfile >+=head2 _init, _recheck_logfile > > =cut > > sub _init { >- my $rv; >- if ( exists $ENV{"LOG4PERL_CONF"} and $ENV{'LOG4PERL_CONF'} and -s $ENV{"LOG4PERL_CONF"} ) { >- >- # Check for web server level configuration first >- # In this case we ASSUME that you correctly arranged logfile >- # permissions. If not, log4perl will crash on you. >- # We will not parse apache files here. >- Log::Log4perl->init_once( $ENV{"LOG4PERL_CONF"} ); >- } >- elsif ( C4::Context->config("log4perl_conf") ) { >- >- # Now look in the koha conf file. We only check the permissions of >- # the default logfiles. For the rest, we again ASSUME that >- # you arranged file permissions. >- my $conf = C4::Context->config("log4perl_conf"); >- if ( $rv = _check_conf($conf) ) { >- Log::Log4perl->init_once($conf); >- return $rv; >- } >- else { >- return 0; >- } >- } >- else { >- # This means that you do not use log4perl currently. >- # We will not be forcing it. >- return 0; >- } >- return 1; # if we make it here, log4perl did not crash :) >-} > >-sub _check_conf { # check logfiles in log4perl config (at initialization) >- my $file = shift; >- return if !-r $file; >- open my $fh, '<', $file; >- my @lines = <$fh>; >- close $fh; >- my @logs; >- foreach my $l (@lines) { >- if ( $l =~ /(OPAC|INTRANET)\.filename\s*=\s*(.*)\s*$/i ) { >- >- # we only check the two default logfiles, skipping additional ones >- return if !-w $2; >- push @logs, $1 . ':' . $2; >- } >- } >- return if !@logs; # we should find one >- return \@logs; >+ my $log4perl_config = >+ exists $ENV{"LOG4PERL_CONF"} >+ && $ENV{'LOG4PERL_CONF'} >+ && -s $ENV{"LOG4PERL_CONF"} >+ # Check for web server level configuration first >+ # In this case we ASSUME that you correctly arranged logfile >+ # permissions. If not, log4perl will crash on you. >+ ? $ENV{"LOG4PERL_CONF"} >+ : C4::Context->config("log4perl_conf"); >+ >+ # This will explode with the relevant error message if something is wrong in the config file >+ return Log::Log4perl->init_once($log4perl_config); > } > > sub _recheck_logfile { # recheck saved logfile when logging message >-- >2.24.2 (Apple Git-127)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25172
:
103088
|
103089
|
103090
|
103091
|
103300
|
103301
|
103302
|
103303
|
103304
|
103305
|
103306
|
103307
|
103310
| 103391 |
103392
|
103393
|
103394
|
103395
|
103485