operating system services the following example illustrates how you create custom filterclass filterfunc(logging filter)def _init_ (self,name)self funcname name def filter(selfrecord)if record funcname =self funcnamereturn false elsereturn true log addfilter(filterfunc('foo')log addfilter(filterfunc('bar')ignore all messages originating from foo(ignore all messages originating from bar(message propagation and hierarchical loggers in advanced logging applicationslogger objects can be organized into hierarchy this is done by giving logger object name such as 'app net clientherethere are actually three different logger objects called 'app''app net'and 'app net clientwhen message is issued on any of the loggers and it successfully passes that logger' filterit propagates to and is handled by all of the parents for examplea message successfully issued on 'app net clientalso propagates to 'app net''appand the root logger the following attributes and methods of logger object log control this propagation log propagate boolean flag that indicates whether or not messages propagate to the parent logger by defaultthis is set to true log geteffectivelevel(returns the effective level of the logger if level has been set using setlevel()that level is returned if no level has been explicitly set (the level is logging notset in this case)this function returns the effective level of the parent logger instead if none of the parent loggers have level setthe effective level of the root logger will be returned the primary purpose of hierarchical logging is to be able to more easily filter log messages originating from different parts of large application for exampleif you wanted to shut down log messages from the 'app net clientpart of an applicationyou might add configuration code such as the followingimport logging logging getlogger('app net client'propagate false orin this codewe're ignoring all but the most severe messages from program moduleimport logging logging getlogger('app net client'setlevel(logging criticala subtle aspect of hierarchical loggers is that the decision to handle log message is made entirely by the level and filters on the logger object on which the message was issuednot by the filters on any of the parents thusif message passes the first set of filtersit is propagated to and handled by all the parent loggers regardless of their own filter and level settings--even if these filters would have rejected the message at first glancethe behavior is counterintuitive and might even seem like bug howeversetting the level of child logger to value that is lower than its parent is one way to lib fl ff