Bug 16357: Override __WARN__ in Plack to use Log4Perl
commitd8717c994ee37e298e80a4c0e4f83c35c6c62b9a
authorDavid Cook <dcook@prosentient.com.au>
Mon, 22 Jun 2020 03:53:16 +0000 (22 03:53 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 20 Oct 2020 14:25:31 +0000 (20 14:25 +0000)
treec0b7501634259134a9683545b24453c1e9ebf601
parentd35a7e753e29a840af8bb1173e285e01575830af
Bug 16357: Override __WARN__ in Plack to use Log4Perl

This patch overrides __WARN__ in Plack to use Log4Perl to add
timestamps to error output. The Log4Perl config uses a screen
appender so the output still goes to STDERR so that it is still
managed by Starman.

This patch adds a Plack::Middleware::LogWarn package dependency.
(The dependency is very simplistic, so we could always do out own
 version if we would prefer to skip the external dependency.)

To Test:
0) apt-get install libplack-middleware-logwarn-perl
1) Apply patch
2) Copy PLACK block from etc/log4perl.conf to
/etc/koha/sites/kohadev/log4perl.conf
3) Copy debian/templates/plack.psgi to /etc/koha/sites/kohadev/plack.psgi
4) Create some output on STDERR (it might be necessary to add
a 'warn "TEST";' line to the intranet or OPAC)
5) koha-plack --restart kohadev
6) Open /var/log/koha/kohadev/plack-error.log
7) Observe a log line like the following:
[2020/06/22 03:51:23] [WARN] TEST at /kohadevbox/koha/opac/opac-user.pl line 59.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 57c62a612d7a8c590a2b5ef0ce75d9915471e19a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
debian/control
debian/templates/log4perl-site.conf.in
debian/templates/plack.psgi
etc/log4perl.conf