Bugzilla – Attachment 139942 Details for
Bug 22678
Set 'Koha::Logger' as the default mojo logger for the REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22678: Replace a few unneeded Koha::Logger calls
Bug-22678-Replace-a-few-unneeded-KohaLogger-calls.patch (text/plain), 2.69 KB, created by
Marcel de Rooy
on 2022-08-29 12:18:56 UTC
(
hide
)
Description:
Bug 22678: Replace a few unneeded Koha::Logger calls
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-08-29 12:18:56 UTC
Size:
2.69 KB
patch
obsolete
>From 63eec05cb8aa8b3763ddc51cc3696392ae0e62e0 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 29 Aug 2022 09:58:38 +0000 >Subject: [PATCH] Bug 22678: Replace a few unneeded Koha::Logger calls >Content-Type: text/plain; charset=utf-8 > >We have Koha::Logger via the Mojo app now. > >Test plan: >Run perl t/db_dependent/api/v1/unhandled_exceptions.t >Your plack-api-error.log should contain something like: > [2022/08/29 12:15:25] [ERROR] DELETE /api/v1/patrons/1052: unhandled exception (Koha::Exception)<<Exception 'Koha::Exception' thrown 'delete died'>> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/REST/Plugin/Exceptions.pm | 4 +--- > Koha/REST/Plugin/PluginRoutes.pm | 8 +++----- > 2 files changed, 4 insertions(+), 8 deletions(-) > >diff --git a/Koha/REST/Plugin/Exceptions.pm b/Koha/REST/Plugin/Exceptions.pm >index b069711596..fd28d67e7f 100644 >--- a/Koha/REST/Plugin/Exceptions.pm >+++ b/Koha/REST/Plugin/Exceptions.pm >@@ -18,7 +18,6 @@ package Koha::REST::Plugin::Exceptions; > use Modern::Perl; > > use Scalar::Util qw( blessed ); >-use Koha::Logger; > > use Mojo::Base 'Mojolicious::Plugin'; > >@@ -69,8 +68,7 @@ sub register { > > my $message = "$method $path: unhandled exception $type\<\<$exception_string\>\>"; > >- my $logger = Koha::Logger->get({ interface => 'api' }); >- $logger->error("$message"); >+ $c->app->log->error( "$message" ); > > $c->render( > status => 500, >diff --git a/Koha/REST/Plugin/PluginRoutes.pm b/Koha/REST/Plugin/PluginRoutes.pm >index e626a179b8..c275f2578c 100644 >--- a/Koha/REST/Plugin/PluginRoutes.pm >+++ b/Koha/REST/Plugin/PluginRoutes.pm >@@ -21,7 +21,6 @@ use Mojo::Base 'Mojolicious::Plugin'; > > use Koha::Exceptions::Plugin; > use Koha::Plugins; >-use Koha::Logger; > > use Clone qw( clone ); > use JSON::Validator::Schema::OpenAPIv2; >@@ -57,7 +56,7 @@ sub register { > ); > > foreach my $plugin ( @plugins ) { >- $spec = $self->inject_routes( $spec, $plugin, $validate ); >+ $spec = $self->inject_routes( $spec, $plugin, $validate, $app->log ); > } > > } >@@ -70,7 +69,7 @@ sub register { > =cut > > sub inject_routes { >- my ( $self, $spec, $plugin, $validate ) = @_; >+ my ( $self, $spec, $plugin, $validate, $logger ) = @_; > > return merge_spec( $spec, $plugin ) unless $validate; > >@@ -91,8 +90,7 @@ sub inject_routes { > catch { > my $error = $_; > my $class = ref $plugin; >- my $logger = Koha::Logger->get({ interface => 'api' }); >- $logger->error("Plugin $class route injection failed: $error"); >+ $logger->error( "Plugin $class route injection failed: $error" ); > return $spec; > }; > } >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22678
:
139813
|
139816
|
139940
|
139942
|
139943
|
139944
|
142318
|
142319
|
142320