Log message to a file or stderr
Use logging module to log message
log messages are sent to a file or to sys.stderr.
import logging# from w w w . j a v a2 s .c o m
logging.debug('Debugging information')
logging.info('Informational message')
logging.warning('Warning:config file %s not found', 'server.conf')
logging.error('Error occurred')
logging.critical('Critical error -- shutting down')
The code above generates the following result.