I've been at it and all over my code, and perhaps am blinkered by it.
Following setup in my __main__.py:
if args.debug: logpath = '{}/ganalytics_mf70.dbg'.format(backend.utilities.get_module_path()) lvl = logging.DEBUG else: logpath = '{}/ganalytics_mf70.log'.format(backend.utilities.get_module_path()) lvl = logging.INFO log = logging.getLogger('GAnalytics') log.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s: %(name)-12s: %(levelname)-8s %(message)s') fh = logging.FileHandler(logpath) # file logging fh.setLevel(lvl) fh.setFormatter(formatter) formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') ch = logging.StreamHandler() # console logging ch.setFormatter(formatter) ch.setLevel(logging.INFO) log.addHandler(ch) log.addHandler(fh) All other .py files have
import logging log = logging.GetLogger(__name__) at the top.
package outline:
program/ - backend/ - foo.py - bar.py - spam.py - __init__.py - __main__.py This logs all log.debug and higher calls in my __main__.py - but none of the log calls in spam, bar, foo or __init__ py files.
Where's the glaringly obvious mistake I'm not seeing?