Trying to understand logging.Filter
reply.in.the.newsgroup at my.address.is.invalid
Wed Jan 25 07:14:05 EST 2006
I'd expect the program below to put only one line with "Eat me" in the log
file. However, I get this with Python 2.4.2 in WingIDE on Windows XP:
My understanding is:
1. Event "Ignore me" is logged to logger 'spam'.
2. Logger 'spam' has no handler associated with it, so this logger doesn't
do anything with the event.
3. The event is dispatched to the root logger as well, since this is an
ancestor of 'spam'. This works as expected, since the event "Eat me" is
logged by the root logger.
4. The root logger has a Filter, which requires the logger of the event to
be 'ham', or offspring thereof. 'spam' is not offspring of 'ham' in the
dotted name hierarchy, so the event should be ignored.
So why does "Ignore me" end up in the logfile? What am I missing?
rootLogger = logging.getLogger()
logging.getLogger().info("Ignore me too")
Wat wil jij worden? http://www.carrieretijger.nl
More information about the Python-list