qInstallMessageHandler not showing anything when in debug mode
-
Hi,all:
platform: win10+5.14.1+vs2017. qtcreator 4.11/ 6.0.2
with helper, qInstallMessageHandler runs fine when you run the app, but if you press F5 enter debug mode, it shows nothing. I have to uncomment ://qInstallMessageHandler()
so it can show debug string again. why?
good shown:
bad shown in DEBUG MODE:
-
Hi, I also use qInstallMessageHandler and I remember also having problems with debug output: inside Qt there is a check for recursive calls to a custom message handler (in case there's a qDebug() call inside your message handler for example) so I ended up calling the Win32 OutputDebugString() directly in my message handler, like this:
::OutputDebugStringA(qUtf8Printable(msg + "\n"));
In Linux and on the Mac fprintf() and fflush() work fine, it's just Windows that needs this workaround. Maybe it can solve your problem too...
-
I also try GDB, if adding fflush(stderr), it outputs perfectly. but delay output if not adding fflush():
Maybe this is a qc bug when using CDB ??? -
Hi, I also use qInstallMessageHandler and I remember also having problems with debug output: inside Qt there is a check for recursive calls to a custom message handler (in case there's a qDebug() call inside your message handler for example) so I ended up calling the Win32 OutputDebugString() directly in my message handler, like this:
::OutputDebugStringA(qUtf8Printable(msg + "\n"));
In Linux and on the Mac fprintf() and fflush() work fine, it's just Windows that needs this workaround. Maybe it can solve your problem too...
-
Hi, I also use qInstallMessageHandler and I remember also having problems with debug output: inside Qt there is a check for recursive calls to a custom message handler (in case there's a qDebug() call inside your message handler for example) so I ended up calling the Win32 OutputDebugString() directly in my message handler, like this:
::OutputDebugStringA(qUtf8Printable(msg + "\n"));
In Linux and on the Mac fprintf() and fflush() work fine, it's just Windows that needs this workaround. Maybe it can solve your problem too...
@hskoglund Works for me, thank you. I confirm it is a qtctreator's BUG.