Results 1 to 4 of 4

Thread: Using QLoggingCategory, rules precedence seem backwards

  1. #1
    Join Date
    Aug 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Using QLoggingCategory, rules precedence seem backwards

    I want to instrument my codebase with QLoggingCategory. The issue for me is the precedence order of the rules mechanisms given the fact that all logging is on by default. Given the fact that all logging is on by default it would make sense to set a sensible level of logging. The two mechanism to do that would be:

    1) Calling setFilterRules in the code.
    2) Setup a qtlogging.ini file pre-populated with those sensible settings. But that means every developer working in the code needs to take the manual setup of placing the file in the right place. That issue points me to #1

    Now if I am debugging something and find that I want to turn on additional logging I would like to do that without having to modify code. The qtlogging.ini seems ideal for this since it is outside the codebase. But with the qtlogging.ini as the lowest order in the rule precedence below setFilterRules it doesn't work.

    That would seem to be a common pattern to follow. Is there a different way to do the same thing, while avoiding #2?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QLoggingCategory, rules precedence seem backwards

    What about building qtlogging.ini into the program using Qt's resource mechanism and extracting it on startup if not present yet.

    That would take care of "But that means every developer working in the code needs to take the manual setup of placing the file in the right place"

    Cheers,
    _

  3. #3
    Join Date
    Aug 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using QLoggingCategory, rules precedence seem backwards

    Hmm, yeah. Good idea. I'll try that. Thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QLoggingCategory, rules precedence seem backwards

    You can also have a custom config file(s) somewhere inside the project and point the environment variable QT_LOGGING_CONF

    Cheers,
    _

Similar Threads

  1. Qwt 6 backwards compatibility with Qwt 5
    By bcastalia in forum Qwt
    Replies: 5
    Last Post: 27th December 2012, 13:20
  2. SLOT naming rules
    By George Neil in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2010, 09:08
  3. Is this Qt backwards compatible with 4.4.3
    By afflictedd2 in forum Newbie
    Replies: 4
    Last Post: 17th October 2010, 17:07
  4. Qt Creator Backwards compatibility question Qt and QtCreator
    By spawn9997 in forum Qt Tools
    Replies: 3
    Last Post: 4th February 2010, 18:41
  5. [solved] QHostAddress::toSring() backwards?
    By ucntcme in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2007, 00:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.