cron scripts should log everything, but only send mail for errors

Bug #640125 reported by Martin Pool
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Stuart Bishop

Bug Description

I think we want all cronscripts to

 - emit to stderr (and from there through cron to mail) all messages of severity ERROR or higher
 - send everything to a log file (i guess opened directly, unless we especially want to go through syslog)

This should be pretty easy to do on top of python logging; we just need to decide what configuration options if any are needed. (Perhaps there is some standard argv->logging mapping?)

See launchpad-dev thread "cron script error output handling".

Related branches

Revision history for this message
Tom Haddon (mthaddon) wrote :

I think the "send everything to a logfile" part is something we should just be defining in the crontab entry. Otherwise we'd have to define log file locations for every individual script and changing them would be unnecessarily complex.

tags: added: canonical-losa-lp
Revision history for this message
Stuart Bishop (stub) wrote :

We recently added a cronscript.ini control file. Would it make sense to extend this?

[DEFAULT]
enabled=True
# Log INFO or higher messages
log=/srv/launchpad.net/logs/%(name)s.log
log_level=INFO

[process-mail]
# Log DEBUG3 or higher messages
log_level=DEBUG3

With the config to shortly be available over the network from a central URL, it could be easier to control that editing and pushing the crontabs.

Revision history for this message
Stuart Bishop (stub) wrote :

All the scripts use the same logging code so this can be fixed in one place for everything. canonical.launchpad.scripts.logger_options() sets up the python logging system and command line arguments, and everything else just uses the standard Python logging module.

Martin Pool (mbp)
Changed in launchpad-foundations:
assignee: nobody → Stuart Bishop (stub)
importance: Undecided → Medium
status: New → In Progress
Stuart Bishop (stub)
Changed in launchpad-foundations:
status: In Progress → Fix Committed
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
Changed in launchpad-foundations:
milestone: none → 10.10
tags: added: qa-needstesting
Stuart Bishop (stub)
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in launchpad-foundations:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.