GUI applications writing garbage to stdout/stderr

Kevin Kofler kevin.kofler at chello.at
Sun Jan 18 02:33:54 UTC 2015


Orion Poplawski wrote:
> Sounds good to me - my users (old unix folks who always use the command
> line) are always complaining about this.  Where do we tweak that?

Unfortunately, it can't really be done without modifications to either Qt or 
the Qt applications. Either we build the applications with 
QT_NO_DEBUG_OUTPUT and QT_NO_WARNING_OUTPUT (and fix them if they rely on 
side effects in the debugging lines, or on <QDebug> getting implicitly 
included), or we patch the default message handlers in Qt itself (e.g., to 
print nothing unless some QT_DEBUG environment variable is set).

It is unfortunate that upstream does not provide a better way to disable all 
output at runtime. The only thing that can be controlled at runtime is 
kDebug with a context number (kdelibs 3 and 4) or qCDebug/qCWarning/… with a 
declared context name (Qt 5). Uncategorized qDebug/qWarning/… cannot be 
enabled/disabled at runtime. At least Qt 5 also allows categorized 
qCWarning, but I doubt it is in wide use.

        Kevin Kofler



More information about the devel mailing list