Bugzilla – Attachment 121855 Details for
Bug 28555
Improve output of verbose option for overdue_notices.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28555: Improve logging for overdue_notices.pl
Bug-28555-Improve-logging-for-overduenoticespl.patch (text/plain), 3.99 KB, created by
Nick Clemens (kidclamp)
on 2021-06-11 15:15:36 UTC
(
hide
)
Description:
Bug 28555: Improve logging for overdue_notices.pl
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-06-11 15:15:36 UTC
Size:
3.99 KB
patch
obsolete
>From dc0026d58625659a6f2495430d3b67a785944ef5 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 11 Jun 2021 15:12:32 +0000 >Subject: [PATCH] Bug 28555: Improve logging for overdue_notices.pl > >Currenlty the output with -v from overdue_notices is a bit overwhelming and hard to parse > >I do a few things here: >1 - Only show SQL if verbose > 1 >2 - Add some separators to make it more readab;e >3 - Remove some redundant messages with branchcode and borrowernumber > >To test: >1: perl misc/cronjobs/overdue_notices.pl -v >2: Notice you get a LOT of information all smushed together >3: Apply patch >4: perl misc/cronjobs/overdue_notices.pl -v >5: Less info, and easier to read >6: perl misc/cronjobs/overdue_notices.pl -v -v >7: All the info, but nicer to read >--- > misc/cronjobs/overdue_notices.pl | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 16d708c0dc..892272c7e5 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -318,7 +318,7 @@ my ( $date_input, $today ); > GetOptions( > 'help|?' => \$help, > 'man' => \$man, >- 'v' => \$verbose, >+ 'v|verbose+' => \$verbose, > 'n' => \$nomail, > 'max=s' => \$MAX, > 'library=s' => \@branchcodes, >@@ -475,6 +475,7 @@ foreach my $branchcode (@branches) { > || $library->inbound_email_address; > my @output_chunks; # may be sent to mail or stdout or csv file. > >+ $verbose and print "======================================\n"; > $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address; > > my $sql2 = <<"END_SQL"; >@@ -529,9 +530,10 @@ END_SQL > next unless defined $mindays; > > if ( !$overdue_rules->{"letter$i"} ) { >- $verbose and warn "No letter$i code for branch '$branchcode'"; >+ $verbose and warn sprintf "No letter code found for pass %s\n", $i; > next PERIOD; > } >+ $verbose and warn sprintf "Using letter code '%s' for pass %s\n", $overdue_rules->{"letter$i"}, $i; > > # $letter->{'content'} is the text of the mail that is sent. > # this text contains fields that are replaced by their value. Those fields must be written between brackets >@@ -567,7 +569,12 @@ END_SQL > my $sth = $dbh->prepare($borrower_sql); > $sth->execute(@borrower_parameters); > >- $verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows"; >+ if ( $verbose > 1 ){ >+ warn sprintf "--------Borrower SQL------\n"; >+ warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\n"; >+ warn sprintf "--------------------------\n"; >+ } >+ $verbose and warn sprintf "Found %s borrowers with overdues\n", $sth->rows; > my $borrowernumber; > while ( my $data = $sth->fetchrow_hashref ) { > >@@ -607,8 +614,7 @@ END_SQL > $data->{'firstname'} && $data->{'surname'} ? ', ' : '', > $data->{'firstname'} || '', > $borrowernumber ); >- $verbose >- and warn "borrower $borr has items triggering level $i."; >+ $verbose and warn "borrower $borr has items triggering level $i.\n"; > > my $patron = Koha::Patrons->find( $borrowernumber ); > @emails_to_use = (); >@@ -648,7 +654,6 @@ END_SQL > $verbose and warn "debarring $borr\n"; > } > my @params = ($borrowernumber,$branchcode); >- $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber"; > > $sth2->execute(@params); > my $itemcount = 0; >-- >2.11.0
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 28555
:
121855
|
134076
|
140968
|
141726
|
142001
|
142016
|
142017
|
142018