From f10d0c781e6f605684de32d58dbffbd05a4b99a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Korbel?= Date: Mon, 4 Apr 2022 21:02:38 +0700 Subject: Ensure tag used for logging on Android does not contain spaces Tag passed to __android_log_print shouldn't contain spaces because filter-spec used by adb logcat expects space-separeate list of tag:priority specifiers. Effectively, its not possible to filter tag using logcat if Qt's application name has spaces. Pick-to: 6.2 6.3 Change-Id: I52b706b7a368d0700db45c0406bbfef279bc61fb Reviewed-by: BogDan Vatra --- src/corelib/global/qlogging.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/global/qlogging.cpp') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index e0dbfcf09b..88656e6b86 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1737,9 +1737,10 @@ static bool android_default_message_handler(QtMsgType type, break; }; + // If application name is a tag ensure it has no spaces // If a category is defined, use it as an Android logging tag __android_log_print(priority, isDefaultCategory(context.category) ? - qPrintable(QCoreApplication::applicationName()) : context.category, + qPrintable(QCoreApplication::applicationName().replace(" ", "_")) : context.category, "%s\n", qPrintable(formattedMessage)); return true; // Prevent further output to stderr -- cgit v1.2.3