My logging behaves as I expect now and I have a better understanding of how the module functions. Thank you for taking the time to explain those points to me. :)
On Nov 30, 4:10 pm, Vinay Sajip <vinay_sa...@yahoo.co.uk> wrote: > On Nov 30, 6:52 am, Grimsqueaker <grimsqueake...@gmail.com> wrote: > > > > > So would I be correct in saying that Filters apply only the the object > > they are attached to and have no effect on how messages are propagated > > through thelogginghierarchy? If this is the case my next question > > would be: How can I affect whether or not a message is propagated > > further up the tree? > > You are correct about how Filters work. To prevent propagation, use > the propagate attribute, documented here: > > http://docs.python.org/library/logging.html#logger-objects > > Most times, you don't need to use this. For example, if you want > events in the A hierarchy to go to one place and events in the B > hierarchy to go to another place (e.g. two different log files), you > just attach different handlers (e.g. two different FileHandlers) to > loggers A and B. If you want a combined log as well, add an > appropriate handler to the root logger. > > I find that things usually work OK if I just determine what handlers I > need and attach them to the appropriate loggers, setting the levels on > handlers and loggers appropriately. If I need filtering logic for a > logger or handler which is more involved than just an integer > threshold (which happens less often), I use Filters. Even less often, > if I need to block events from a part of the logger hierarchy from > bubbling upwards, then I use the propagate attribute. > > Regards, > > Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list