Bugzilla – Attachment 179071 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.71 KB, created by
Martin Renvoize (ashimema)
on 2025-03-07 12:22:22 UTC
(
hide
)
Description:
Bug 39153: Move log4perl checks in about.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-03-07 12:22:22 UTC
Size:
3.71 KB
patch
obsolete
>From 6b348956047aec71b5d5adb4fe6e1f7595f3c7f5 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 > >They were mostly under tab about, but they should be under sysinfo. > >Test plan: >If you would move your log4perl file, plack.psgi crashes. So sorry >but we cannot test that. >Note that you cannot simulate logfile_not_writable either, since it >also crashes plack.psgi before reaching about.pl. See 39155. > >So a trivial hack remains: >Bonus: Edit about.pl and changed the moved if( !-w $file ) test and >replace it by if ( 1 ) in the new sub log4perl_check. >Restart and verify that you now have an error message on sysinfo. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > about.pl | 49 +++++++++++++++++++++++++++++-------------------- > 1 file changed, 29 insertions(+), 20 deletions(-) > >diff --git a/about.pl b/about.pl >index eaaf419b2f8..799f8ed9107 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 won't 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.48.1
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