[Koha-bugs] [Bug 13889] Add information about cron jobs to system log

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Apr 21 16:03:50 CEST 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13889

--- Comment #25 from Marc Véron <veron at veron.ch> ---
(In reply to Jonathan Druart from comment #23)
> (In reply to Jonathan Druart from comment #22)
> > Created attachment 38239 [details] [review] [review]
> > Bug 13889: Log with parameters
> 
> Marc, What do you think of this patch?

Jonatan, I like the idea. I was thinking about adding some more detailed
information to the action log before and I planned to expand it after this
patch set is pushed. 

First consideration:

With the patch, I have the following problem:

Call of cronlogaction() without param does not display the path:
2015-04-21 15:24:09     0     Cron jobs     Run     0

Call of cronlogaction(join ' ', $0, @ARGV) displays the path and the params:
2015-04-21 15:24:09     0     Cron jobs     Run     0    
misc/cronjobs/overdue_notices.pl -n -csv 

IMO cronlogaction() (without param) should behave as before.

Second consideration: 

I think it would be better tho have a string as param and to prepend it with
caller(0))[1] or whatever it needs to display the script's name. 
(That is what I was planning as a next step.)

With a string param it is up to the logscript's author to decide what to
communicate in the logs (in a human readable form), e.g. not only the params
but their defaults as well if no params are passed.

That brings me to the third consideration: 

The original idea is that the log is written after all of the preconditions. If
the script dies before doing anything "real", no log is written. Otherwise we
have an entry in the logs for a cronjob that was called but did not do
anything, and users think that everything is OK.

With the string param mentioned above the author of the log file then can use
logging for more sophisticated things (if necessary), e.g.

- cronlogaction("start")
- do the preconditions and log some information if it dies:
cronlogaction("fail: ..reason...)"
- cronlogaction("execute with: ...intersting params / defaults...")
- cronlogaction("success") or cronlogaction("success: ...interesting
results...")

As a minimum, cronlogaction should be called as soon the script does the real
work (that's what my patches to the cronjobs do at the moment), in the sense of
"Hi, I was here and did something"

So I propose to add the string parameter and, for this first step, leave the
calls in the cron scripts as is.

What do you think?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list