Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Logging library for Qt

Logging library for Qt

Scheduled Pinned Locked Moved General and Desktop
8 Posts 6 Posters 5.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    artem.marchenko
    wrote on last edited by
    #1

    I am quite new to Qt and I am looking for a logging library.

    Something that would have several priorities to be enabled, disabled (errors, warnings, infos), could print to console or file and ideally have a set of macros that would automagically add classname and method name to the log file.

    I tried googling around, managed to find mentions of Log4Qt and QxtLogger, but somehow not much activity around them and surprising amount of messages on just using qInstallMsgHandler() and creating a custom logger just for yourself.

    What would be a supported logging library to study closer?
    Or is everybody really creating his own logger and that's it?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      Why do you need any logging libraries? Qt has great and simple logging possibilities...

      Using qDebug(), qWarning() & qCritical() with implemented MsgHandler function can do everything what you need and it's done in 5 minutes...

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        QxtLogger works just fine. There is also work going on in Qt itself to make more detailed logging possible, but that will be for Qt5.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Scylla
          wrote on last edited by
          #4

          Or take a look at "this":http://developer.qt.nokia.com/forums/viewthread/2654 .

          1 Reply Last reply
          0
          • xstreamX Offline
            xstreamX Offline
            xstream
            wrote last edited by
            #5

            Hi. Writing qInstallMsgHandler() yourself is pointless. There's a ready-made library that already implements all the necessary cases: https://github.com/yamixst/qtlogger
            Just include qtlogger.h, call gQtLogger.configure(), and you've got super-advanced logging :)

            SGaistS 1 Reply Last reply
            0
            • xstreamX xstream

              Hi. Writing qInstallMsgHandler() yourself is pointless. There's a ready-made library that already implements all the necessary cases: https://github.com/yamixst/qtlogger
              Just include qtlogger.h, call gQtLogger.configure(), and you've got super-advanced logging :)

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote last edited by
              #6

              @xstream Hi,

              Thanks for sharing ! It looks pretty interesting.
              I think there might be one thing missing from it: QLoggingCategory support.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              xstreamX 1 Reply Last reply
              0
              • SGaistS SGaist

                @xstream Hi,

                Thanks for sharing ! It looks pretty interesting.
                I think there might be one thing missing from it: QLoggingCategory support.

                xstreamX Offline
                xstreamX Offline
                xstream
                wrote last edited by
                #7

                @SGaist Just try it. The category is fully supported. there is both filtering and printing of categories.

                1 Reply Last reply
                1
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote last edited by
                  #8

                  My bad ! I somehow missed your use of QLoggingCategory although I looked for it.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved