From dfde9865a4989b379ea0ccef5e04ac0358c26b1f Mon Sep 17 00:00:00 2001 From: Mason James Date: Sat, 17 Feb 2018 02:00:47 +1300 Subject: [PATCH] Bug 16357 - Plack error logs are not time stamped to test this patch.. 1/ start plack $ sudo koha-plack --start mylib 2/ tail log file, notice error log has no timestamps :( $ sudo tail -f /var/log/koha/mylib/plack-error.log ... Initiating an anonymous session... at /usr/share/koha/lib/C4/Auth.pm line 1294. Checking Auth at /usr/share/koha/lib/C4/Auth.pm line 815. 3/ apply patch 4 manually copy new plack file to live location $ sudo cp ./debian/templates/plack.psgi /etc/koha/ 5/ restart plack $ sudo koha-plack --restart mylib 6/ tail log file, notice error log now has timestamps :) $ sudo tail -f /var/log/koha/mylib/plack-error.log ... 2018/02/11 08:56:29 Initiating an anonymous session... at /usr/share/koha/lib/C4/Auth.pm line 1294. 2018/02/11 08:56:33 Checking Auth at /usr/share/koha/lib/C4/Auth.pm line 815. --- debian/templates/plack.psgi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi index 3538b9a5a1..eac3553196 100644 --- a/debian/templates/plack.psgi +++ b/debian/templates/plack.psgi @@ -37,6 +37,15 @@ use Koha::Cache::Memory::Lite; use Koha::Database; use Koha::DateUtils; +#BZ 16520, add timestamps to warnings +use Log::Log4perl qw(:easy); +Log::Log4perl->easy_init($WARN); +my $logger = Log::Log4perl->get_logger(); # use the default logger style +$SIG{__WARN__} = sub { + my $message = shift; + $logger->warn($message); +}; + use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise { no warnings 'redefine'; -- 2.11.0