diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-07-08 00:21:39 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-09-29 17:42:25 +0200 |
commit | cc50651cceda35fa1a2ae89236a926ddfa3c7b32 (patch) | |
tree | c747953171872d856de3416d548975ffe6934180 /src/testlib | |
parent | 85062a3028e2c50ce8f48ab020587a1bb0a5647b (diff) |
Update the detection of when to log to stderr
On Windows, the detection changes only by inserting the use of the
environment variable before the existing tests and removing the check on
stderr.
This commit adds logic similar to Windows's: if the application has a
controlling TTY, we'll use stderr. Otherwise, we'll use the system log.
This is technically a change in behavior: previously, we would always
use the system log, unless the environment variable told us not to.
In practice, the behavior doesn't really change: Android and BlackBerry
and systemd-spawned applications are launched with no controlling TTY,
so logging will go to their logging systems.
[ChangeLog][Important behavior changes][Logging (including qDebug and
qWarning)] Log output will now go to the system log (if support for it
was compiled into Qt) if the application has no controlling terminal or
console window. Set QT_LOGGING_TO_CONSOLE to 1 to force logging to go to
stderr.
Task-number: QTCREATORBUG-12564
Change-Id: I043c5c4f47c15f26d4f4a5cf43df466ea38cdbc7
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qplaintestlogger.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 703c6aa54e..e58daa528d 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -202,7 +202,7 @@ namespace QTest { } #if defined(Q_OS_WIN) -Q_CORE_EXPORT bool qWinLogToStderr(); // defined in qlogging.cpp +Q_CORE_EXPORT bool qt_logging_to_console(); // defined in qlogging.cpp #endif void QPlainTestLogger::outputMessage(const char *str) @@ -218,7 +218,7 @@ void QPlainTestLogger::outputMessage(const char *str) if (stream != stdout) #elif defined(Q_OS_WIN) // log to system log only if output is not redirected, and no console is attached - if (!qWinLogToStderr() && stream == stdout) { + if (!qt_logging_to_console() && stream == stdout) { OutputDebugStringA(str); return; } |