Bugzilla – Attachment 109055 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 separate Log4Perl logger for each Plack app
Bug-16357-Use-separate-Log4Perl-logger-for-each-Pl.patch (text/plain), 6.05 KB, created by
Joonas Kylmälä
on 2020-08-25 07:02:37 UTC
(
hide
)
Description:
Bug 16357: Use separate Log4Perl logger for each Plack app
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2020-08-25 07:02:37 UTC
Size:
6.05 KB
patch
obsolete
>From 8ac0368d90a80474af1a34062b099f7918e2e259 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 26 Jun 2020 02:25:10 +0000 >Subject: [PATCH] Bug 16357: Use separate Log4Perl logger for each Plack app >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch creates separate timestamped Log4Perl loggers >for each Plack app, so that the Intranet, OPAC, and API are logged >to separate files. > >To Test: >0) apt-get install libplack-middleware-logwarn-perl >1) Apply "Alternative" patches >2) Copy PLACK block from etc/log4perl.conf to >/etc/koha/sites/kohadev/log4perl.conf and replace __LOG_DIR__ appropriately >3) Copy debian/templates/plack.psgi to /etc/koha/sites/kohadev/plack.psgi >4) Temporarily add 'warn "TEST"' to opac-main.pl and mainpage.pl >5) koha-plack --restart kohadev >6) Go to /cgi-bin/koha/mainpage.pl and /cgi-bin/koha/opac-main.pl >7) Open /var/log/koha/kohadev/plack-opac-error.log and >/var/log/koha/kohadev/plack-intranet-error.log >7) Observe a log line like the following: >[2020/06/22 03:51:23] [WARN] TEST at <SCRIPT and line #>. > >Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com> >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > debian/templates/log4perl-site.conf.in | 31 ++++++++++++++++++++++++------- > debian/templates/plack.psgi | 21 +++++++++++++++------ > etc/log4perl.conf | 31 ++++++++++++++++++++++++------- > 3 files changed, 63 insertions(+), 20 deletions(-) > >diff --git a/debian/templates/log4perl-site.conf.in b/debian/templates/log4perl-site.conf.in >index b893241559..16446c2ffd 100644 >--- a/debian/templates/log4perl-site.conf.in >+++ b/debian/templates/log4perl-site.conf.in >@@ -38,10 +38,27 @@ log4perl.appender.SIP.layout=PatternLayout > log4perl.appender.SIP.layout.ConversionPattern=[%d] [%p] %m %l %n > log4perl.appender.SIP.utf8=1 > >-log4perl.logger.plack = WARN, PLACK >-log4perl.appender.PLACK=Log::Log4perl::Appender::Screen >-log4perl.appender.PLACK.stderr = 1 >-log4perl.appender.PLACK.mode=append >-log4perl.appender.PLACK.layout=PatternLayout >-log4perl.appender.PLACK.layout.ConversionPattern=[%d] [%p] %m >-log4perl.appender.PLACK.utf8=1 >+ >+log4perl.logger.plack-opac = WARN, PLACKOPAC >+log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File >+log4perl.appender.PLACKOPAC.filename=__LOG_DIR__/plack-opac-error.log >+log4perl.appender.PLACKOPAC.mode=append >+log4perl.appender.PLACKOPAC.layout=PatternLayout >+log4perl.appender.PLACKOPAC.layout.ConversionPattern=[%d] [%p] %m >+log4perl.appender.PLACKOPAC.utf8=1 >+ >+log4perl.logger.plack-api = WARN, PLACKAPI >+log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File >+log4perl.appender.PLACKAPI.filename=__LOG_DIR__/plack-api-error.log >+log4perl.appender.PLACKAPI.mode=append >+log4perl.appender.PLACKAPI.layout=PatternLayout >+log4perl.appender.PLACKAPI.layout.ConversionPattern=[%d] [%p] %m >+log4perl.appender.PLACKAPI.utf8=1 >+ >+log4perl.logger.plack-intranet = WARN, PLACKINTRANET >+log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File >+log4perl.appender.PLACKINTRANET.filename=__LOG_DIR__/plack-intranet-error.log >+log4perl.appender.PLACKINTRANET.mode=append >+log4perl.appender.PLACKINTRANET.layout=PatternLayout >+log4perl.appender.PLACKINTRANET.layout.ConversionPattern=[%d] [%p] %m >+log4perl.appender.PLACKINTRANET.utf8=1 >diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi >index c06ff4b913..32d17940ae 100644 >--- a/debian/templates/plack.psgi >+++ b/debian/templates/plack.psgi >@@ -71,15 +71,24 @@ Koha::Logger->get; > builder { > enable "ReverseProxy"; > enable "Plack::Middleware::Static"; >- enable "Log4perl", category => "plack"; >- enable "LogWarn"; > > # + is required so Plack doesn't try to prefix Plack::Middleware:: > enable "+Koha::Middleware::SetEnv"; > enable "+Koha::Middleware::RealIP"; > >- mount '/opac' => $opac; >- mount '/intranet' => $intranet; >- mount '/api/v1/app.pl' => $apiv1; >- >+ mount '/opac' => builder { >+ enable 'Log4perl', category => 'plack-opac'; >+ enable 'LogWarn'; >+ $opac; >+ }; >+ mount '/intranet' => builder { >+ enable 'Log4perl', category => 'plack-intranet'; >+ enable 'LogWarn'; >+ $intranet; >+ }; >+ mount '/api/v1/app.pl' => builder { >+ enable 'Log4perl', category => 'plack-api'; >+ enable 'LogWarn'; >+ $apiv1; >+ }; > }; >diff --git a/etc/log4perl.conf b/etc/log4perl.conf >index b893241559..16446c2ffd 100644 >--- a/etc/log4perl.conf >+++ b/etc/log4perl.conf >@@ -38,10 +38,27 @@ log4perl.appender.SIP.layout=PatternLayout > log4perl.appender.SIP.layout.ConversionPattern=[%d] [%p] %m %l %n > log4perl.appender.SIP.utf8=1 > >-log4perl.logger.plack = WARN, PLACK >-log4perl.appender.PLACK=Log::Log4perl::Appender::Screen >-log4perl.appender.PLACK.stderr = 1 >-log4perl.appender.PLACK.mode=append >-log4perl.appender.PLACK.layout=PatternLayout >-log4perl.appender.PLACK.layout.ConversionPattern=[%d] [%p] %m >-log4perl.appender.PLACK.utf8=1 >+ >+log4perl.logger.plack-opac = WARN, PLACKOPAC >+log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File >+log4perl.appender.PLACKOPAC.filename=__LOG_DIR__/plack-opac-error.log >+log4perl.appender.PLACKOPAC.mode=append >+log4perl.appender.PLACKOPAC.layout=PatternLayout >+log4perl.appender.PLACKOPAC.layout.ConversionPattern=[%d] [%p] %m >+log4perl.appender.PLACKOPAC.utf8=1 >+ >+log4perl.logger.plack-api = WARN, PLACKAPI >+log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File >+log4perl.appender.PLACKAPI.filename=__LOG_DIR__/plack-api-error.log >+log4perl.appender.PLACKAPI.mode=append >+log4perl.appender.PLACKAPI.layout=PatternLayout >+log4perl.appender.PLACKAPI.layout.ConversionPattern=[%d] [%p] %m >+log4perl.appender.PLACKAPI.utf8=1 >+ >+log4perl.logger.plack-intranet = WARN, PLACKINTRANET >+log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File >+log4perl.appender.PLACKINTRANET.filename=__LOG_DIR__/plack-intranet-error.log >+log4perl.appender.PLACKINTRANET.mode=append >+log4perl.appender.PLACKINTRANET.layout=PatternLayout >+log4perl.appender.PLACKINTRANET.layout.ConversionPattern=[%d] [%p] %m >+log4perl.appender.PLACKINTRANET.utf8=1 >-- >2.11.0
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