From 9d8d9321e800e0ccfda895a9060b2800947982e8 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 12 May 2022 04:09:58 +0000 Subject: [PATCH] Bug 30738: Log warnings for background MARC import This change logs warnings from the CGI background MARC import. Test plan: 0) Apply patch 1) Export a record with an item 2) Update the 952$f subfield to "Circulation" (any value over 10 chars) 3) Import the record and try to add the item 4) The import will stay stuck with "Importing" status and 0% job progress 5) Check the /var/log/koha/kohadev/intranet-error.log file and notice there's an error with the following text: "Data too long for column 'coded_location_qualifier' at row 1" Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- tools/manage-marc-import.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index 87aae2afd9..e84178fe42 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -35,6 +35,8 @@ use C4::BackgroundJob; use C4::Labels::Batch; use Koha::BiblioFrameworks; +use Koha::Logger; + my $script_name = "/cgi-bin/koha/tools/manage-marc-import.pl"; my $input = CGI->new; @@ -330,6 +332,11 @@ sub put_in_background { # we're now running in the background close STDOUT; close STDERR; + $SIG{__WARN__} = sub { + my ($msg) = @_; + my $logger = Koha::Logger->get; + $logger->warn($msg); + } } else { # fork failed, so exit immediately warn "fork failed while attempting to run tools/manage-marc-import.pl as a background job"; -- 2.39.5