I have implemented an application using python2.7, Qt5.5 and PyQt5. I got Python-logger using logging-Module: Log-Messages are sent to stderr and to the log file.
However, Qt log messages only appear in stderr, and I could not find a way to redirect them to a file.
To narrow down the problem, I tried this:
>>> from PyQt5.QtCore import qDebug
>>> import sys
>>> sys.stderr = open("stderr.txt", 'w')
>>> qDebug('test message')
test message
>>> sys.stderr.close()
>>>
Note: Apparently, the pure-Qt method manipulates the object QDebug, but I could not find the class in PyQt5.
Question: How can I QDebugwrite to a file stderr.txt?
source
share