|
Pythomnic » Documentation » Logging (priority)
As always, you need to find a good balance for logging verbosity. You can
log your every move but it will make the log bloated and unreadable and
hurt application performance. You can log nothing but it will prevent
you from understanding what's going on.
This dilemma is frequently resolved by introducing priority levels for
logging. More important messages will have higher priority and will more
likely appear in the log. The application will then be able to set a
priority threshold so that only messages with high enough priority are
recorded.
Pythomnic has the following log levels:
1. Errors (highest priority)
2. Health-monitor messages 3. Warnings 4. Application-produced and more relevant informational messages 5. Less relevant informational messages 6. not used 7. Debugging messages (lowest priority)
which you can explicitly specify in a call to pmnc_log:
try:
...
except Exception, e:
pmnc_log("%s happened" % e, priority = 1)
The default output priority for pmnc_log is 4, and same is recommended
threshold level. Although the default threshold level is 5 as it is more
verbose, it also turns out to be noisier.
To specify the logging threshold level you need to start the cage in the
following manner:
root@node> python startup.py node cage /usr/local/pythomnic/logs#4
appending a "#threshold" suffix to the logging directory.
|
Features Download Documentation Tutorial |