Bugzilla – Attachment 178268 Details for
Bug 39153
About does not handle log4perl warnings correctly.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39153: Move log4perl checks in about.pl
Bug-39153-Move-log4perl-checks-in-aboutpl.patch (text/plain), 3.53 KB, created by
Marcel de Rooy
on 2025-02-18 14:11:22 UTC
(
hide
)
Description:
Bug 39153: Move log4perl checks in about.pl
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2025-02-18 14:11:22 UTC
Size:
3.53 KB
patch
obsolete
>From 4414590bb2c493f1b3ede520bde0e2d064fb942b Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 18 Feb 2025 14:03:39 +0000 >Subject: [PATCH] Bug 39153: Move log4perl checks in about.pl >Content-Type: text/plain; charset=utf-8 > >They were mostly under tab about, but they should be under sysinfo. > >Test plan: >Move your log4perl file and verify that about complains on sysinfo. >Note that you cannot simulate logfile_not_writable, since it crashes >plack.psgi before reaching about.pl. See 39155. >Bonus: Edit the moved if( !-w $file ) test and replace it by if ( 1 ). >Restart and verify that you now have an error message on sysinfo. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > about.pl | 49 +++++++++++++++++++++++++++++-------------------- > 1 file changed, 29 insertions(+), 20 deletions(-) > >diff --git a/about.pl b/about.pl >index eaaf419b2f..952bfdf10b 100755 >--- a/about.pl >+++ b/about.pl >@@ -120,23 +120,6 @@ if ( $tab eq 'about' ) { > environment_invalid => $env_invalid > }; > >- { # Logger checks >- my $log4perl_config = C4::Context->config("log4perl_conf"); >- my @log4perl_errors; >- if ( !$log4perl_config ) { >- push @log4perl_errors, 'missing_config_entry'; >- } else { >- my @lines = read_file($log4perl_config) or push @log4perl_errors, 'cannot_read_config_file'; >- for my $line (@lines) { >- next unless $line =~ m|log4perl.appender.\w+.filename=(.*)|; >- push @log4perl_errors, 'logfile_not_writable' unless -w $1; >- } >- } >- eval { Koha::Logger->get }; >- push @log4perl_errors, 'cannot_init_module' and warn $@ if $@; >- $template->param( log4perl_errors => @log4perl_errors ); >- } >- > $template->param( > time_zone => $time_zone, > current_date_and_time => output_pref( { dt => dt_from_string(), dateformat => 'iso' } ) >@@ -274,9 +257,7 @@ if ( $tab eq 'sysinfo' ) { > push @xml_config_warnings, { error => 'zebra_auth_index_mode_mismatch_warn' }; > } > >- if ( !defined C4::Context->config('log4perl_conf') ) { >- push @xml_config_warnings, { error => 'log4perl_entry_missing' }; >- } >+ log4perl_check( $template, \@xml_config_warnings ); > > if ( !defined C4::Context->config('lockdir') ) { > push @xml_config_warnings, { error => 'lockdir_entry_missing' }; >@@ -829,6 +810,34 @@ if ( $tab eq 'history' ) { > } > } > >+sub log4perl_check { >+ my ( $template, $xml_config_warnings ) = @_; >+ >+ if ( !defined C4::Context->config('log4perl_conf') ) { >+ push @$xml_config_warnings, { error => 'log4perl_entry_missing' }; >+ } >+ >+ my $log4perl_config = C4::Context->config("log4perl_conf"); >+ my @log4perl_errors; >+ if ( !$log4perl_config ) { >+ push @log4perl_errors, 'missing_config_entry'; >+ } else { >+ my @lines = read_file($log4perl_config) or push @log4perl_errors, 'cannot_read_config_file'; >+ for my $line (@lines) { >+ next unless $line =~ m|log4perl\.appender\.\w+\.filename=(.*)|; >+ my $file = $1; >+ if ( !-w $file ) { >+ push @log4perl_errors, 'logfile_not_writable'; >+ >+ #NOTE: An unwritable logfile blocks plack.psgi. So you wont reach this script. (BZ 39155) >+ } >+ } >+ } >+ eval { Koha::Logger->get }; >+ push @log4perl_errors, 'cannot_init_module' and warn $@ if $@; >+ $template->param( log4perl_errors => @log4perl_errors ); >+} >+ > sub elasticsearch_check { > my $template = shift; > >-- >2.39.5
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 39153
:
178268
|
178269
|
178299
|
179071