[bitbake-devel] [PATCH 1/1] lib/bb/codeparser: ensure BufferedLogger respects target filtering

Paul Eggleton paul.eggleton at linux.intel.com
Tue Mar 28 19:50:46 UTC 2017


On Wednesday, 29 March 2017 5:01:31 AM NZDT Christopher Larson wrote:
> On Mon, Mar 27, 2017 at 5:51 PM, Paul Eggleton <
> paul.eggleton at linux.intel.com> wrote:
> > BufferedLogger was sending log records to the target logger using
> > handle() - this meant that the filtering (e.g. log level set)
> > on the target logger was bypassed, leading for example to debug records
> > getting printed when the log level was set to logging.WARNING.
> > 
> > Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
> 
> The ‘filter’ method of a Logger instance doesn’t log anything, it’s a
> subclass of Filterer, which just checks whether it should be logged. The
> ‘handle’ method of a Logger already consults self.filter(), if you check
> the code:
> 
>    def handle(self, record):
>           """
>           Call the handlers for the specified record.
> 
>           This method is used for unpickled records received from a socket,
> as
>           well as those created locally. Logger-level filtering is applied.
>           """
>           if (not self.disabled) and self.filter(record):
>               self.callHandlers(record)

Oops, you're right. I'm still confused about why I'm seeing debugging messages 
when the target logger is set to INFO then. Do you have any suggestions on how 
we fix this?

(I've attached a simplified test script demonstrating the issue.)

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testlogging.py
Type: text/x-python
Size: 1101 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20170329/eb926e29/attachment-0002.py>


More information about the bitbake-devel mailing list