PySide6 disables logging debug level
-
wrote on 13 Aug 2021, 09:43 last edited by Strangelove
I can't understand why PySide6 seems to interfere with my logging configuration. Consider this:
import logging logging.basicConfig(level=logging.DEBUG) logging.debug('Hey')
This outputs:
DEBUG:root:Hey
But this:
import logging import PySide6 logging.basicConfig(level=logging.DEBUG) logging.debug('Hey')
Output nothing.
The order of imports doesn't matter. Also, importing a specific module from PySide6 doesn't seem to matter either (e.g.
from PySide6.QtWidgets import QAbstractButton
gives the same result).If I use a custom logger, the
debug
level works but every message is displayed twice, but only if PySide6 is imported:import logging from PySide6.QtWidgets import QAbstractButton logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setFormatter(logging.Formatter('[ %(levelname)s ] %(name)s : %(message)s')) logger.addHandler(ch) logger.debug('Hey')
Results in:
[ DEBUG ] __main__ : Hey DEBUG:__main__:Hey
Remove the PySide6 import, and I only get the first message.
Why is that happening?
Thanks.
-
Hi,
Which version of PySide6 are you using ?
On which platform ?
Which which version of Python ? -
Hi,
Which version of PySide6 are you using ?
On which platform ?
Which which version of Python ?wrote on 13 Aug 2021, 19:37 last edited by@SGaist Pyside 6.1.2, macOS Catalina, Python 3.9.6.
Please have a look at my SO post for more details (in the comments). I can get around this behavior by manually removing the handler that the PySide6 import seems to add to my logger. But it feels like a hack.
-
@SGaist Pyside 6.1.2, macOS Catalina, Python 3.9.6.
Please have a look at my SO post for more details (in the comments). I can get around this behavior by manually removing the handler that the PySide6 import seems to add to my logger. But it feels like a hack.
wrote on 13 Aug 2021, 19:54 last edited by eyllanesc@Strangelove It seems like a bug introduced in PySide6 since it is not observed in PySide2 so I recommend you report it: https://bugreports.qt.io/projects/PYSIDE/issues, here we can do little or nothing. I also reproduce that behavior on Linux with PySide6 6.1.2 and python 3.9.6.
-
@Strangelove It seems like a bug introduced in PySide6 since it is not observed in PySide2 so I recommend you report it: https://bugreports.qt.io/projects/PYSIDE/issues, here we can do little or nothing. I also reproduce that behavior on Linux with PySide6 6.1.2 and python 3.9.6.
wrote on 13 Aug 2021, 20:10 last edited by@eyllanesc said in PySide6 disables logging debug level:
I recommend you report it
Just did. Thanks a lot.
4/5