From cbfa57d66008c1df215521c342182c1200a3d8b7 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. Signed-off-by: Josef Moravec --- 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 9b3f74dbb2..50de0b4109 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1028,7 +1028,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 df327e9c55..fee6a7c967 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -37,6 +37,8 @@ Overloaded Mojolicious->startup method. It is called at application startup. sub startup { my $self = shift; + C4::Context->interface('rest'); + # Remove /api/v1/app.pl/ from the path $self->hook( before_dispatch => sub { shift->req->url->base->path('/'); diff --git a/etc/log4perl.conf b/etc/log4perl.conf index efc470746a..b64d3c7102 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 -- 2.11.0