From 79df16849e55441409a16cbf1dfbaa1355d0f37e Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 7 Mar 2022 12:55:24 +0000 Subject: [PATCH] Bug 30242: Allow changing Mojolicious log level Content-Type: text/plain; charset=utf-8 Add an optional config variable to koha-conf and set log level in sub startup. Test plan: Check last line of plack-error.log. Hit the REST API. When you have a dev_install, you should see new log line(s). For a regular install, there may be no new log lines. Signed-off-by: Marcel de Rooy --- Koha/REST/V1.pm | 4 ++++ debian/templates/koha-conf-site.xml.in | 5 +++++ etc/koha-conf.xml | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index 62d326e0fd..3a7b69271e 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -43,6 +43,10 @@ Overloaded Mojolicious->startup method. It is called at application startup. sub startup { my $self = shift; + my $log_level = C4::Context->config('mojo_log_level') || + ( C4::Context->config('dev_install') ? 'trace' : 'info' ); + $self->log->level($log_level); + $self->hook( before_dispatch => sub { my $c = shift; diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 29b378bc70..d55fcd30db 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -462,5 +462,10 @@ __END_SRU_PUBLICSERVER__ KohaOpacLanguage --> + + diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml index 0d0c50ea24..5c89ddafbf 100644 --- a/etc/koha-conf.xml +++ b/etc/koha-conf.xml @@ -278,5 +278,10 @@ KohaOpacLanguage --> + + -- 2.20.1