summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Weimer <bernd.weimer@pelagicore.com>2019-09-18 11:35:10 +0200
committerBernd Weimer <bernd.weimer@pelagicore.com>2019-09-19 09:41:30 +0200
commitd835bb2e738c658cda134d85c1eff8a54cfc279d (patch)
tree72cb7d67d0384d35497ecb90159ce63a65cb09b4
parent877e4cd4cf7f581a0a92eb2adb6f95695b186104 (diff)
Fix logging output
The messagePattern given in the am-config.yaml is set as env variable QT_MESSAGE_PATTERN. However this might be too late for the System UI (the env variable is evaluated by Qt before it is set by appman), so the pattern will be set explicitly with qSetMessagePattern. Change-Id: Ie8c9858feb600cd2b03ed5d6f77874235e0a05df Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--src/common-lib/logging.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common-lib/logging.cpp b/src/common-lib/logging.cpp
index f14629d0..24cc003d 100644
--- a/src/common-lib/logging.cpp
+++ b/src/common-lib/logging.cpp
@@ -334,11 +334,10 @@ void Logging::setFilterRules(const QStringList &rules)
void Logging::setMessagePattern(const QString &pattern)
{
- if (!pattern.isEmpty()) {
- if (!s_messagePatternDefined) {
- qputenv("QT_MESSAGE_PATTERN", pattern.toLocal8Bit());
- s_messagePatternDefined = true;
- }
+ if (!pattern.isEmpty() && !s_messagePatternDefined) {
+ qputenv("QT_MESSAGE_PATTERN", pattern.toLocal8Bit()); // pass on to application processes, however for the
+ qSetMessagePattern(pattern); // System UI this might be too late, so set pattern explicitly here.
+ s_messagePatternDefined = true;
}
}