Often the question comes up what to information do you want to log and when do you log it?
First rule of thumb, don't put log messages in anything that would be inside tight loop. This likely will impact performance and will spew lots making the log pretty useless.
There are now 7 additional logging level, INFO1-5 and DEBUG1-2. The old logging levels/priorities are retained SEVERE, WARN, INFO, DEBUGGING. The
LogSink controls what log messages go into the log file. Set the filter to INFO1 then SEVERE, WARN, INFO, and INFO1 will go into the logfile, set it to DEBUGGING and everything will go into the log file. The log filter level can be controlled for the global logger in python using casalog.filter.
Paraphrasing Steve Myer's
CAS-355 issue, here are some guidelines
SEVERE errors that cause the operation to fail
WARN it ran, but there are issues
INFO information that the user requested by running
the task/tool (e.g. imstat)
INFO1 diagnostic information helpful to the user to see what
happened (e.g. total cleaned flux)
INFO2 information to indicate what is going on,
progress through task (e.g. for timing)
INFO3 a user supplied note (e.g. entered in logger,
or via a "addnote" task)
INFO4,5 DEBUG1,2 DEBUGGING lowest priorities, any debugging info the
developers feel they have to include, but are
limited utility for users (most of current
messages)
The priority levels in the C++ source have different names from the levels displayed in the logger...
C++ (LogMessage.h) Priority |
Logger Priority |
DESCRIPTION |
SEVERE |
SEVERE |
errors that cause the operation to fail |
WARN |
WARN |
it ran, but there are issues |
NORMAL |
INFO |
information that the user requested by running the task/tool (e.g. imstat) |
NORMAL1 |
INFO1 |
diagnostic information helpful to the user to see what happened (e.g. total cleaned flux) |
NORMAL2 |
INFO2 |
information to indicate what is going on, progress through task (e.g. for timing) |
NORMAL3 |
INFO3 |
a user supplied note (e.g. entered in logger, or via a "addnote" task) |
NORMAL{4,5}, DEBUG{1,2}, DEBUGGING |
INFO{4,5}, DEBUG{1,2}, DEBUGGING |
lowest priorities, any debugging info the developers feel they have to include, but are limited utility for users (most of current messages) |
Please note when ever you output a
LogMessage to a
LogSink, the message is constructed and the filter level determines whether it goes into the log file. The current filter level is set to INFO, this should probably modified to INFO2 or INFO3 per Steve's guidelines. Take your best guess as to what an appropriate level is for a log message, the users will likely complain if there is too little or too much information. As a rule of thumb, most folks want to know, did it start, is it running, did it finished.
Logging Facility
Logging Interface