From da96e24431fb280346e4e2bc7b43e7ce3fb8fb71 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 Just a rudimentary approach: Add a config variable to koha-conf and set log level when calling ->startup. Test plan: Add var to your koha-conf. Hit the API. Check your plack-error.log with/without this patch. Toggle log level, check again. Signed-off-by: Marcel de Rooy --- Koha/REST/V1.pm | 3 +++ debian/templates/koha-conf-site.xml.in | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index 1c22a769d7..fca9affa83 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -42,6 +42,9 @@ Overloaded Mojolicious->startup method. It is called at application startup. sub startup { my $self = shift; + my $level = C4::Context->config('mojo_log_level') || 'warn'; + $self->log->level($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 6525e4ce97..2120df3a91 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -449,5 +449,7 @@ __END_SRU_PUBLICSERVER__ __MESSAGE_BROKER_VHOST__ + warn + -- 2.20.1