From 2681210e2984d0c35c9d11ec00e9258a873ff5a0 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 3 Mar 2017 15:38:34 +0200 Subject: [PATCH] Bug 18205: Add interface 'rest' for Koha::Logger This patch adds an interface 'rest' for Koha::Logger. --- C4/Context.pm | 3 ++- Koha/REST/V1.pm | 2 ++ etc/log4perl.conf | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/C4/Context.pm b/C4/Context.pm index a50ddfd..ec3cd33 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1020,7 +1020,8 @@ sub interface { if (defined $interface) { $interface = lc $interface; - if ($interface eq 'opac' || $interface eq 'intranet' || $interface eq 'sip' || $interface eq 'commandline') { + if ($interface eq 'opac' || $interface eq 'intranet' || $interface eq 'sip' || + $interface eq 'commandline' || $interface eq 'rest' ) { $context->{interface} = $interface; } else { warn "invalid interface : '$interface'"; diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index e0ac94b..488b28c 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -43,6 +43,8 @@ Overloaded Mojolicious->startup method. It is called at application startup. sub startup { my $self = shift; + C4::Context->interface('rest'); + # Force charset=utf8 in Content-Type header for JSON responses $self->types->type(json => 'application/json; charset=utf8'); diff --git a/etc/log4perl.conf b/etc/log4perl.conf index efc4707..b64d3c7 100644 --- a/etc/log4perl.conf +++ b/etc/log4perl.conf @@ -11,3 +11,13 @@ log4perl.appender.OPAC.filename=__LOG_DIR__/opac-error.log log4perl.appender.OPAC.mode=append log4perl.appender.OPAC.layout=PatternLayout log4perl.appender.OPAC.layout.ConversionPattern=[%d] [%p] %m %l %n + +log4perl.logger.rest = WARN, REST +log4perl.appender.REST=Log::Log4perl::Appender::File +log4perl.appender.REST.filename=__LOG_DIR__/rest.log +log4perl.appender.REST.create_at_logtime=true +log4perl.appender.REST.syswrite=true +log4perl.appender.REST.recreate=true +log4perl.appender.REST.mode=append +log4perl.appender.REST.layout=PatternLayout +log4perl.appender.REST.layout.ConversionPattern=[%d] [%p] %m %l %n -- 1.9.1