I've googled and looked at the default documentation, but I can't figure out why this doesn't produce three lines of logging:
# main.py import logging import apple import banana log = logging.getLogger('main') log.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) log.addHandler(ch) log.info("I'm in main!") # apple.py import logging log = logging.getLogger('main.apple') log.info("I'm here in apple!") # banana.py import logging log = logging.getLogger('main.banana') log.info("I'm here in banana!") # output 2011-09-03 16:40:54,062 - main - INFO - I'm in main! But the example in the logging documentation works fine.
Any ideas?