Writing debug information both in file and Windows debugger
Good day, colleagues!
How could I write debug info both to custom place (e. g. in file) and to default location (e. g. Windows debug console)?
Currently I use qInstallMsgHandler with this handler:
What should I add to my code to write to the default debug output too?
Easiest way is to use a different logger than Qt’s. QxtLogger comes to mind. That one can also easily integrate with Qt (register itself as the Qt Message handler), so your qDebug()‘s still end up in your log file.
I requested a merge request for a logger engine I wrote for it for the Windows logger stream. I don’t think it is in the 0.6 version (yet), but it should still be in the repo.
What we dot here in our custom logger is simply
in addition to writing to file.
If stdout doesn’t please you, you can use OutputDebugString
to print in debug console
[EDIT: fixed link formatting, Volker]