(continued from previous page) Running this module from the command line produces the following output: The following Python module creates a logger, handler, and formatter nearly identical to those in the example listed above, with the only difference being the names of the objects: Here is the logging.conf file: (continues on next page) 10 [loggers] keys=root,simpleExample [handlers] keys=consoleHandler [formatters] keys=simpleFormatter [logger_root] level =DEBUG handlers=consoleHandler import logging import logging.config logging.config.fileConfig('logging.conf ') # create logger logger=logging.getLogger('simpleExample ') # 'application' code logger.debug( 'debug message') logger.info('info message') logger.warning( 'warn message') logger.error('error message') logger.critical( 'critical message') $ python simple_logging_module.py 2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message 2005-03-19 15:10:26,620 - simple_example - INFO - info message 2005-03-19 15:10:26,695 - simple_example - WARNING - warn message 2005-03-19 15:10:26,697 - simple_example - ERROR - error message 2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical ch.setLevel(logging .DEBUG) # create formatter formatter=logging.Formatter(' %(asctime)s - %(name)s - %(levelname)s - %(message)s ↪ → ') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) # 'application' code logger.debug( 'debug message') logger.info('info message') logger.warning( 'warn message') logger.error('error message') logger.critical( 'critical message')