Bugzilla – Attachment 73404 Details for
Bug 16357
Plack error logs are not time stamped
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16357 - Use Koha::Logger via Plack::Middleware::Log4perl
Bug-16357---Use-KohaLogger-via-PlackMiddlewareLog4.patch (text/plain), 4.70 KB, created by
David Bourgault
on 2018-03-28 20:06:51 UTC
(
hide
)
Description:
Bug 16357 - Use Koha::Logger via Plack::Middleware::Log4perl
Filename:
MIME Type:
Creator:
David Bourgault
Created:
2018-03-28 20:06:51 UTC
Size:
4.70 KB
patch
obsolete
>From 869f120e23fbaeb01523e644abf761b7714ca817 Mon Sep 17 00:00:00 2001 >From: David Bourgault <dav.bour@gmail.com> >Date: Wed, 28 Mar 2018 15:01:32 -0400 >Subject: [PATCH] Bug 16357 - Use Koha::Logger via Plack::Middleware::Log4perl > >Changes plack.psgi to use the Koha::Logger via Plack::Middleware::Log4perl. > >Changes the log category to 'plack' to be more similar to the existing categories >--- > debian/templates/log4perl-site.conf.in | 7 +++++++ > debian/templates/plack.psgi | 12 +++++------- > etc/log4perl.conf | 12 ++++++------ > misc/plack/koha.psgi | 14 +++++++------- > 4 files changed, 25 insertions(+), 20 deletions(-) > >diff --git a/debian/templates/log4perl-site.conf.in b/debian/templates/log4perl-site.conf.in >index efc4707..91df7d6 100644 >--- a/debian/templates/log4perl-site.conf.in >+++ b/debian/templates/log4perl-site.conf.in >@@ -11,3 +11,10 @@ log4perl.appender.OPAC.filename=__LOG_DIR__/opac-error.log > log4perl.appender.OPAC.mode=append > log4perl.appender.OPAC.layout=PatternLayout > log4perl.appender.OPAC.layout.ConversionPattern=[%d] [%p] %m %l %n >+ >+log4perl.logger.plack = WARN, PLACK >+log4perl.appender.PLACK=Log::Log4perl::Appender::File >+log4perl.appender.PLACK.filename=__LOG_DIR__/plack-error.log >+log4perl.appender.PLACK.mode=append >+log4perl.appender.PLACK.layout=PatternLayout >+log4perl.appender.PLACK.layout.ConversionPattern=[%d] [%p] %m >diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi >index 2c65dc7..778befd 100644 >--- a/debian/templates/plack.psgi >+++ b/debian/templates/plack.psgi >@@ -36,14 +36,8 @@ use Koha::Caches; > use Koha::Cache::Memory::Lite; > use Koha::Database; > use Koha::DateUtils; >- >-#BZ 16357, add timestamps to warnings > use Koha::Logger; > >-my $logger = Koha::Logger->get({ interface => 'plack-error' }); >-$SIG{__WARN__} = sub { $logger->warn(shift); }; >-$SIG{__DIE__} = sub { $logger->fatal(shift); }; >- > use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise > { > no warnings 'redefine'; >@@ -72,14 +66,18 @@ my $apiv1 = builder { > $server->to_psgi_app; > }; > >+Koha::Logger->get; >+ > builder { > enable "ReverseProxy"; > enable "Plack::Middleware::Static"; >+ enable "Log4perl", category => "plack"; >+ enable "LogErrors"; >+ enable "LogWarn"; > # + is required so Plack doesn't try to prefix Plack::Middleware:: > enable "+Koha::Middleware::SetEnv"; > > mount '/opac' => $opac; > mount '/intranet' => $intranet; > mount '/api/v1/app.pl' => $apiv1; >- > }; >diff --git a/etc/log4perl.conf b/etc/log4perl.conf >index bcf8159..91df7d6 100644 >--- a/etc/log4perl.conf >+++ b/etc/log4perl.conf >@@ -12,9 +12,9 @@ log4perl.appender.OPAC.mode=append > log4perl.appender.OPAC.layout=PatternLayout > log4perl.appender.OPAC.layout.ConversionPattern=[%d] [%p] %m %l %n > >-log4perl.logger.plack-error = WARN, PLACK-ERROR >-log4perl.appender.PLACK-ERROR=Log::Log4perl::Appender::File >-log4perl.appender.PLACK-ERROR.filename=__LOG_DIR__/plack-error.log >-log4perl.appender.PLACK-ERROR.mode=append >-log4perl.appender.PLACK-ERROR.layout=PatternLayout >-log4perl.appender.PLACK-ERROR.layout.ConversionPattern=[%d] [%p] %m >+log4perl.logger.plack = WARN, PLACK >+log4perl.appender.PLACK=Log::Log4perl::Appender::File >+log4perl.appender.PLACK.filename=__LOG_DIR__/plack-error.log >+log4perl.appender.PLACK.mode=append >+log4perl.appender.PLACK.layout=PatternLayout >+log4perl.appender.PLACK.layout.ConversionPattern=[%d] [%p] %m >diff --git a/misc/plack/koha.psgi b/misc/plack/koha.psgi >index a7989f5..e6fa5e1 100644 >--- a/misc/plack/koha.psgi >+++ b/misc/plack/koha.psgi >@@ -5,13 +5,6 @@ use lib qw( ./lib ); > use Plack::Middleware::Debug; > use Plack::App::Directory; > >-#BZ 16357, add timestamps to warnings >-use Koha::Logger; >- >-my $logger = Koha::Logger->get({ interface => 'plack-error' }); >-$SIG{__WARN__} = sub { $logger->warn(shift); }; >-$SIG{__DIE__} = sub { $logger->fatal(shift); }; >- > use CGI qw(-utf8 ); # we will lose -utf8 under plack > { > no warnings 'redefine'; >@@ -54,6 +47,7 @@ use Koha::DateUtils; > use Koha::Caches; > use Koha::Cache::Memory::Lite; > use Koha::Patron::Categories; >+use Koha::Logger; > > =for preload > use C4::Tags; # FIXME >@@ -79,6 +73,8 @@ my $home = sub { > return [ 302, [ Location => '/cgi-bin/koha/' . ( $ENV{INTRANET} ? 'mainpage.pl' : 'opac-main.pl' ) ] ]; > }; > >+Koha::Logger->get; >+ > builder { > > # please don't use plugins which are under enable_if $ENV{PLACK_DEBUG} in production! >@@ -102,6 +98,10 @@ builder { > path => qr{^/(intranet|opac)-tmpl/}, > root => "$ENV{INTRANETDIR}/koha-tmpl/"; > >+ enable "Log4perl", category => "plack"; >+ enable "LogErrors"; >+ enable "LogWarn"; >+ > # + is required so Plack doesn't try to prefix Plack::Middleware:: > enable "+Koha::Middleware::SetEnv"; > >-- >2.7.4
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 16357
:
71752
|
71753
|
71871
|
72290
|
72296
|
73404
|
77529
|
77530
|
77531
|
77532
|
77533
|
106141
|
106313
|
106319
|
106320
|
109053
|
109054
|
109055
|
109056
|
109060
|
109067
|
109068
|
109133
|
109215
|
110107
|
110108
|
110109
|
110249
|
110250
|
110251
|
110252
|
110253
|
110254