[issue37857] Setting logger.level directly has no effect due to caching in 3.7+

Zane Bitter report at bugs.python.org
Wed Aug 14 15:46:10 EDT 2019


New submission from Zane Bitter <zaneb at fedoraproject.org>:

This is a related issue to bug 34269, in the sense that it is also due to the caching added by the fix for bug 30962.

In this case, the bug is triggered by setting the public 'level' attribute of a logging.Logger object, instead of calling the setLevel() method. Although this was probably never a good idea, prior to Python3.7 it worked as expected. Now it renders the level out of sync with the cache, leading to inconsistent results that are hard to debug.

An example in the wild: https://review.opendev.org/676450

----------
components: Library (Lib)
messages: 349741
nosy: zaneb
priority: normal
severity: normal
status: open
title: Setting logger.level directly has no effect due to caching in 3.7+
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37857>
_______________________________________


More information about the Python-bugs-list mailing list