PDA

View Full Version : VS2012, Qt5.4 and qtlogging.ini



Rayven
7th April 2017, 19:30
I am trying to setup the qtlogging.ini file to setup the categorization rules in Qt. My application (Qt 5.4 and VS2012) is using various categories in the qcDebug|qcWarning etc messages and compiled in Debug mode. I created a qtlogging.ini files and put it into my application directory path\QtProject\qtlogging.ini with the following rules


[Rules]
*.debug=true
pcwb.*=false
logger.*=true


I have two test debug messages


// Inside the .cpp file, but outside a function
Q_LOGGING_CATEGORY( pcwbMain, "pcwb.main" )
Q_LOGGING_CATEGORY( pcwbMainGui, "pcwb.main.gui" )
Q_LOGGING_CATEGORY( pcwbMainTest, "pcwb.main.test" )

// Inside the class constructor
qCDebug( pcwbMainGui, "Gui Test" );
qCDebug( pcwbMainTest, "PCWB Test Message" );


I expect the pcwb categories to not print out, but both still do. Is there something I am missing with the whole QLoggingCategory setup? I feel like it is not finding the ini file at all despite the QStandardPaths::GenericConfigLocations returned include the directory containing the QtProject directory.

UPDATE 1: Explicitly setting the QT_LOGGING_CONF environment variable works, but I would prefer to have the logging.ini file in the application directory and always loaded from the same place.