From 6ce5df7f8e6862edc5a19f80b52a2360ee07d6c7 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 23 Oct 2024 12:22:16 +0000 Subject: [PATCH] Bug 38237: Add logging to erm_run_harvester cronjob This patch simply adds logging to the cronjob To test: 1 - Enable CronjobLog http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CronjobLog 2 - Enable ERMModule http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ERMModule 3 - Home -> E-resource Management -> Data providers -> New data provider Fill from registry or create your own, but change the URL and put in any required numbers We don't need a real test, just to run the ob 4 - perl misc/cronjobs/erm_run_harvester.pl --begin-date 2024-01-01 --dry-run --debug 5 - View the logs, no log of the script 6 - Apply patches 7 - Run the job again 8 - Check logs 9 - Success! Signed-off-by: Pedro Amorim Signed-off-by: Katrin Fischer --- misc/cronjobs/erm_run_harvester.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc/cronjobs/erm_run_harvester.pl b/misc/cronjobs/erm_run_harvester.pl index fa8f0b3828..f637d43166 100755 --- a/misc/cronjobs/erm_run_harvester.pl +++ b/misc/cronjobs/erm_run_harvester.pl @@ -22,9 +22,12 @@ use Getopt::Long qw( GetOptions ); use Koha::DateUtils qw( dt_from_string ); use POSIX; +use C4::Log qw( cronlogaction ); use Koha::Script; use Koha::ERM::EUsage::UsageDataProviders; +my $command_line_options = join(" ",@ARGV); + # Command line option values my $get_help = 0; my $begin_date = 0; @@ -54,6 +57,7 @@ unless ($begin_date) { die "ERROR: Please specify a begin-date"; } +cronlogaction({ info => $command_line_options }); debug_msg("Dry run: Harvests will not be enqueued") if $dry_run; while ( my $udprovider = $udproviders->next ) { debug_msg( @@ -94,6 +98,8 @@ while ( my $udprovider = $udproviders->next ) { } +cronlogaction({ action => 'End', info => "COMPLETED" }); + sub debug_msg { my ($msg) = @_; -- 2.39.5