Better logging library for C++

50,533

Solution 1

boost::log is probably the most versatile and well-written logging library I've seen. It's pretty complicated but really genius at the same time. And it does everything you can think of and then some more.

Solution 2

I use the glog library, by google (because I could not install Boost.Log easily). It is both simple to use and powerfull.

Solution 3

We use log4cplus in our company, it provides a complex hierarchical logging system (based on log4j). It seems to have everything you are asking for. It provides many appenders (I personally choose this library for the rolling files linux/windows and linux Syslog).

The library is quite simple to compile and deploy on both linux & windows And do the job no problem so far (about 4 years in production).

Only drawback, the lack of documentation but the code it quite self-explanatory. Good new is you could go to the log4j documentation page to understand how configurators/patterns/etc works ...

Solution 4

Check out pantheios!

Share:
50,533
Olympian
Author by

Olympian

Updated on December 17, 2020

Comments

  • Olympian
    Olympian over 3 years

    In our project now we using log4cxx, but those library don't develope some years, also we have some problems with it. Could you advise some library for logging in C++. Library must support multithreade logging, system-log. Also it'll be good if it support logging via << operator. Also lib license must be very democracy - like boost, apache etc Crossplatform support. Must support linux, windows. Better if it support solaris, aix, hp-ux, but it's not necessary.

  • Olympian
    Olympian almost 13 years
    Does this library support multi-logging(don't know how name it) - for example i have module A, B. I want set log-level trace for A and just error for B? And is creating new loggers and setting them easy? Or sometime none-trivial
  • Olympian
    Olympian almost 13 years
    And do you know, why this library now isn't in boost? It's approvement in progress, or some serious problems with it?
  • stijn
    stijn almost 13 years
    I actually don't know the exact reason; maybe it's not mature enough? I've used it for a couple of projects and had no problems with it whatsoever.
  • Ralf
    Ralf almost 13 years
    It was accepted, but there were some issues with getting it into the boost trunk (something to do with the phoenix version IIRC). There was some discussion recently on the boost mailing list regarding this.
  • Olympian
    Olympian almost 13 years
    @Ralf, could you give me link for this message(with reason) please?
  • Ralf
    Ralf almost 13 years
  • Olympian
    Olympian almost 13 years
    Yes, i watch this library. It's easy, but to young - i'm afraid there are some bad bugs:(
  • Olympian
    Olympian almost 13 years
    Thank you very much. We decide to risk and try this library:)
  • Evan Nagle
    Evan Nagle over 10 years
    Pantheios looks really great, except that the author seems to have left it dying on the vine for at least 18 months now, and it won't build using the latest compiler releases :-(
  • Paweł Szczur
    Paweł Szczur over 10 years
    Updated a url, boost::log became a part of official boost release with version 1.54.0
  • Paweł Szczur
    Paweł Szczur over 10 years
    glog has some drawbacks: - it takes configuration from command line flags (and thus works best with gflags); - it expects to be initialized from main thus it's not expected to be used in dynamically loaded libraries (where each lib inits it's own glog); - it lacks doc for windows (e.g. what is a default file path for logs); From the other side: it's high quality, well tested, used in huge production systems.
  • athos
    athos over 7 years
    does things change in 2016?
  • Martin
    Martin about 6 years
    @athos No, these issues are still present in 2018.
  • Craig S. Anderson
    Craig S. Anderson about 6 years
    glog also lacks a DEBUG level, which most other logging libraries have.
  • andreee
    andreee over 5 years
    I'm somewhat late to this party, but I feel that boost::log compiles unreasonably slow. I'm talking >10 seconds compilation time per cpp file where boost::log is included (when precompiled headers aren't used).