Notes about python logging
Consider the following code
1 2 |
import logging logging.info('trying to log something') |
Executing above: It won’t log anything to console, because it default to level warning It won’t log anything to console, because no stream has been set
1 2 3 4 5 |
import logging logging.basicConfig(level=logging.INFO) logging.info('trying to log something') logging.basicConfig(level=logging.DEBUG) logging.debug('trying to log something debug') |
Executing above: Running basicConfig(…) default adds the stream to stderr (unless specified explicitly) to root logger It sets the root logger level to… Read More »