From e9306837ad6eae4799a2875fe7f4686d0ae02227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Tue, 25 Aug 2020 12:22:29 +0000 Subject: [PATCH] Bug 16357: (QA follow-up) Add log4perl configs during package upgrade If plack.psgi is updated to the newer version and the log4perl.conf file is not then the warnings will not be logged anywhere. This adds the log4perl configurations that are needed for logging for pre-existing Koha installation which are upgraded. --- debian/koha-common.postinst | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/debian/koha-common.postinst b/debian/koha-common.postinst index fcdeaa9f73..7ae28bc596 100644 --- a/debian/koha-common.postinst +++ b/debian/koha-common.postinst @@ -190,6 +190,54 @@ EOF done for site in $(koha-list); do + log4perl_config="/etc/koha/sites/$site/log4perl.conf" + if ! log4perl_component $log4perl_config "plack-opac"; then + cat <> $log4perl_config +log4perl.logger.plack-opac = WARN, PLACKOPAC +log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File +log4perl.appender.PLACKOPAC.filename=/var/log/koha/$site/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 + +EOF + fi +done + +for site in $(koha-list); do + log4perl_config="/etc/koha/sites/$site/log4perl.conf" + if ! log4perl_component $log4perl_config "plack-api"; then + cat <> $log4perl_config +log4perl.logger.plack-api = WARN, PLACKAPI +log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File +log4perl.appender.PLACKAPI.filename=/var/log/koha/$site/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 + +EOF + fi +done + +for site in $(koha-list); do + log4perl_config="/etc/koha/sites/$site/log4perl.conf" + if ! log4perl_component $log4perl_config "plack-intranet"; then + cat <> $log4perl_config +log4perl.logger.plack-intranet = WARN, PLACKINTRANET +log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File +log4perl.appender.PLACKINTRANET.filename=/var/log/koha/$site/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 + +EOF + fi +done + +for site in $(koha-list); do kohaconfig="/etc/koha/sites/$site/koha-conf.xml" logdir="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig )" if [ "$logdir" != "" ] && [ "$logdir" != "0" ]; then -- 2.11.0