From 2af910217faea0a213f7dff1bb89f3d0c25d4028 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 18 May 2020 09:23:42 -0300 Subject: [PATCH] Bug 25527: Initialize the logger when required In an OO package, the logger initialization should happen in the constructor. This is not an OO package and the initialization is happening on loading it. This is a wrong behaviour and certainly breaks in environments where initialization cannot happen (package building, for example). There could be several options to solve this, as it is used in a single sub on this package, I opted for initializing on that sub. Signed-off-by: Tomas Cohen Arazi --- C4/ImportBatch.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 739f9f67862..2055a168f9c 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -83,8 +83,6 @@ BEGIN { ); } -our $logger = Koha::Logger->get( { category => 'C4.ImportBatch' } ); - =head1 NAME C4::ImportBatch - manage batches of imported MARC records @@ -800,6 +798,8 @@ sub BatchCommitItems { sub BatchRevertRecords { my $batch_id = shift; + my $logger = Koha::Logger->get( { category => 'C4.ImportBatch' } ); + $logger->trace("C4::ImportBatch::BatchRevertRecords( $batch_id )"); my $record_type; -- 2.26.2