QLoggingRegistry: load all the qtlogging.ini files, not just the first
QStandardPaths::locate() returns the first item that locateAll() would have returned, which may be the user's override file. However, if this file exists, it completely disables loading of the system files, so any rules present there would be ignored, a behavior different from the qtlogging.ini installed in the Qt DATADIR. That means we now match what the documentation said we'd do: The \c QtProject/qtlogging.ini file is looked up in all directories returned by QStandardPaths::GenericConfigLocation. [ChangeLog][QtCore][Logging framework] Fixed a bug that caused the logging framework to not load all the QtProject/qtlogging.ini files found in the user and system configurations. Previously, it would stop parsing after finding the first one; now, all files are processed and their rules are merged. See the QStandardPaths documentation for more information on what file paths are considered in each operating system. Change-Id: I7f6ea7e173e6dc9a8350fffde601bb2ca826a148 Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
69633bcb58
commit
62153d6ce0
@ -309,10 +309,12 @@ void QLoggingRegistry::initializeRules()
|
||||
qr = loadRulesFromFile(qtConfigPath);
|
||||
|
||||
// get rules from user's/system configuration
|
||||
const QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation,
|
||||
QString::fromLatin1("QtProject/") + configFileName);
|
||||
if (!envPath.isEmpty())
|
||||
cr = loadRulesFromFile(envPath);
|
||||
// locateAll() returns the user's file (most overriding) first
|
||||
const QStringList configPaths =
|
||||
QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation,
|
||||
QString::fromLatin1("QtProject/") + configFileName);
|
||||
for (qsizetype i = configPaths.size(); i > 0; --i)
|
||||
cr += loadRulesFromFile(configPaths[i - 1]);
|
||||
|
||||
const QMutexLocker locker(®istryMutex);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user