While most of Koha can use Plack/PSGI these days, there are still a few CGI scripts like "manage-marc-import.pl". This script forks itself in order to run in the background, and in so doing it closes STDOUT and STDERR to tell Apache not to control it anymore. (One day I hope to make this use the RabbitMQ, but that day is not today.) Unfortunately, this means warnings get suppressed. I've noticed cases (usually with items) where a fatal error causes the import to fail (with the batch stuck in "Importing" with a 0% job progress bar) and there are no warnings in the logs! Very frustrating! But we can use Koha::Logger to save the day...
Created attachment 134911 [details] [review] 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"
Created attachment 134941 [details] [review] 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 <david@davidnind.com>
Thanks David! I feel like this one would be useful to a lot of people...
Created attachment 135266 [details] [review] 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 <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Note, this does what the title says, it logs warnings, errors like on 28152 are not logged
Pushed to master for 22.11. Nice work everyone, thanks!