Redirecting stdout/stderr *to* <QDebug>

369 Views Asked by At

I've got a GUI application that makes extensive use of QDebug for logging, and a message handler set up via qInstallMessageHandler.

However, it uses some third-party libraries that print logging info to stdout and stderr.

I'm running into some problems with compatibility. The stdout/stderr messages do show up in the Qt console, although they use a different buffer than the QDebug output and so they're printed significantly out of order relative to QDebug messages. Additionally, things printed to stdout/stderr don't get passed over to the message handler.

My question is: Is it possible to take stdout/stderr and redirect them to whatever handles QDebug messages (in a line-buffered mode, I guess)? If so, how?

0

There are 0 best solutions below