Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PySide6 disables logging debug level
Forum Updated to NodeBB v4.3 + New Features

PySide6 disables logging debug level

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Strangelove
    wrote on last edited by Strangelove
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of PySide6 are you using ?
      On which platform ?
      Which which version of Python ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Which version of PySide6 are you using ?
        On which platform ?
        Which which version of Python ?

        S Offline
        S Offline
        Strangelove
        wrote on last edited by
        #3

        @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.

        eyllanescE 1 Reply Last reply
        0
        • S Strangelove

          @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.

          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by eyllanesc
          #4

          @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.

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          S 1 Reply Last reply
          0
          • eyllanescE 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.

            S Offline
            S Offline
            Strangelove
            wrote on last edited by
            #5

            @eyllanesc said in PySide6 disables logging debug level:

            I recommend you report it

            Just did. Thanks a lot.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved