diff options
-rw-r--r-- | src/corelib/io/qloggingregistry.cpp | 1 | ||||
-rw-r--r-- | src/corelib/io/qloggingregistry_p.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp | 18 |
4 files changed, 6 insertions, 18 deletions
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 9a5c923323..47fb1fb6b8 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -255,7 +255,6 @@ void QLoggingSettingsParser::parseNextLine(QStringRef line) QLoggingRegistry::QLoggingRegistry() : categoryFilter(defaultCategoryFilter) { - init(); } static bool qtLoggingDebug() diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h index 768f3b4a91..69fc6ea4ec 100644 --- a/src/corelib/io/qloggingregistry_p.h +++ b/src/corelib/io/qloggingregistry_p.h @@ -113,6 +113,8 @@ class Q_AUTOTEST_EXPORT QLoggingRegistry public: QLoggingRegistry(); + void init(); + void registerCategory(QLoggingCategory *category, QtMsgType enableForLevel); void unregisterCategory(QLoggingCategory *category); @@ -124,7 +126,6 @@ public: static QLoggingRegistry *instance(); private: - void init(); void updateRules(); static void defaultCategoryFilter(QLoggingCategory *category); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0216baa6c3..e4b1562b8b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -771,6 +771,8 @@ void QCoreApplicationPrivate::init() if (!coreappdata()->applicationVersionSet) coreappdata()->applicationVersion = appVersion(); + QLoggingRegistry::instance()->init(); + #if QT_CONFIG(library) // Reset the lib paths, so that they will be recomputed, taking the availability of argv[0] // into account. If necessary, recompute right away and replay the manual changes on top of the diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index c697cb2203..0a74dc64c0 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -197,23 +197,9 @@ private slots: // Check whether QT_LOGGING_CONF is picked up from environment // - Q_ASSERT(!qApp); - - qputenv("QT_LOGGING_RULES", "qt.foo.bar=true"); + qputenv("QT_LOGGING_CONF", QFINDTESTDATA("qtlogging.ini").toLocal8Bit()); QLoggingRegistry registry; - QCOMPARE(registry.apiRules.size(), 0); - QCOMPARE(registry.configRules.size(), 0); - QCOMPARE(registry.envRules.size(), 1); - QCOMPARE(registry.rules.size(), 1); - - QLoggingCategory qtEnabledByLoggingRule("qt.foo.bar"); - QCOMPARE(qtEnabledByLoggingRule.isDebugEnabled(), true); - QLoggingCategory qtDisabledByDefault("qt.foo.baz"); - QCOMPARE(qtDisabledByDefault.isDebugEnabled(), false); - - qunsetenv("QT_LOGGING_RULES"); - qputenv("QT_LOGGING_CONF", QFINDTESTDATA("qtlogging.ini").toLocal8Bit()); registry.init(); QCOMPARE(registry.apiRules.size(), 0); @@ -318,6 +304,6 @@ private slots: } }; -QTEST_APPLESS_MAIN(tst_QLoggingRegistry) +QTEST_MAIN(tst_QLoggingRegistry) #include "tst_qloggingregistry.moc" |