The logging cookbook gives an Filter example, explainning how to add contextural info to log. I can't figure out how to filter log from it.
Suppose I have 3 file, a.py, b.py and main.py #file: a.py import logging logger=logging.getLogger(__name__) def print_log(): logger.debug("I'm module a") #file: b.py just like a.py import logging logger=logging.getLogger(__name__) def print_log(): logger.debug("I'm module b") #file: main.py import logging from logging import Filter logging.basicConfig(level=logging.DEBUG) logger=logging.getLogger("main") logger.debug("This is main process") logger.addFilter(Filter("a")) And I expected that the console output would contain main and b module log only. But it turned out that all logs there. Is it the problem of root logger? -- http://mail.python.org/mailman/listinfo/python-list