Python’s stdlib logging is
setup as part of the sitecustomize initialization sequence. By default,
INFO and above will be logged to a location as determined by
Debugging via Logging¶
It is highly recommended that you use
DEBUG level logging instead of print statements, since they will not show up to the end users unless it is requested, and then key locations which need debugging output will already have it without having to re-determine where the trouble parts are. It is recommended to use the following pattern at the top of your files:
import logging log = logging.getLogger(__name__) # Do stuff. log.debug('Something crazy is happening...')
You can then get those debug logs dumped to your terminal by using the dev wrapper in verbose mode:
$ dev -v python -m my.awesome.module 2013-04-07 13:48:08,416 DEBUG my.awesome.module: Something crazy is happening...
A format string for determining where to save
logginglogs. Defaults (in the WesternX environment) to:
Keys available include:
-vflags to the :ref:`dev command <dev_command>’.
When set to
"3"will request increasingly higher levels of verbosity. Right now that means decreasing the default logging threshold in Python processes to
A space-or-comma-delimited list of logger names and minimum record levels. E.g.:
$ export SITETOOLS_LOG_LEVELS=:WARNING,mayatools:DEBUG
would set the general logging threshold to
logging.WARNING, but anything within
In an emergency this can effectively disable the logging system by setting:
$ export SITETOOLS_LOG_LEVELS=:100
which is too high for any (built-in) log levels.