qInstallMessageHandler not showing anything when in debug mode
-
wrote on 19 May 2022, 02:04 last edited by QtTester
-
wrote on 20 May 2022, 06:35 last edited by
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...
-
wrote on 19 May 2022, 02:19 last edited by QtTester
-
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 ???wrote on 20 May 2022, 03:52 last edited byAnyone has this problem?
-
wrote on 20 May 2022, 06:35 last edited by
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...
wrote on 20 May 2022, 06:59 last edited by@hskoglund Works for me, thank you. I confirm it is a qtctreator's BUG.
2/5