spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

Switch log files on DButils init #25

Open jtniehof opened 4 years ago

jtniehof commented 4 years ago

ProcessQueue.py switches log files basically as soon as it opens the mission (DButils instance). But none of the other scripts do this, so the relevant logs get scattered between the main dbp log and the mission-specific log.

Proposed enhancement

I think DButils should switch logging on init, so that as soon as the mission is opened the logs are going to the mission-specific file. This would also let the mission-specific log be an entry in the mission table, instead of relying entirely on the environment variable to switch logs.

Note that ProcessQueue also allows the specification of a log level as a command line, and sets this level after the log is switched. This could stay in ProcessQueue, or perhaps be an additional option to DButils. Nevertheless nothing about the log level changing in ProcessQueue requires ProcessQueue to also do the log switching.

Alternatives

Do nothing is always an option.

Could updated some (all?) scripts to do the switch, like ProcessQueue does, which is a fair bit of duplicated code. A similar, but less copy-paste oriented approach, would be to have a common set of command line arguments/parsing and any script which uses that common set would support the log file switch.

@balarsen , I'm curious how this split came about. Maybe there's something I'm missing.

OS, Python version, and dependency version information:

Linux-4.4.0-98-generic-x86_64-with-Ubuntu-16.04-xenial
sys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0)
sqlalchemy=1.0.11

Version of dbprocessing

07f3e3a1ace8f4f72e482e2dd47b951fe00d140d from git master (okay, actually I'm currently off on a branch, but it isn't in a PR yet...)

Closure condition

This issue should be closed when an approach to log switching is decided and a PR implementing it is merged. If there are other relevant enhancements/changes that are captured in other issues, this issue can be closed even if they aren't.

balarsen commented 4 years ago

It was meant to record chain general things in one log file and inspector and mission specific in another. That never really came to any kind of useful fruition and likely doesn't make any sense any more.