Better logging library for C++
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!
Olympian
Updated on December 17, 2020Comments
-
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 almost 13 yearsDoes 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 almost 13 yearsAnd do you know, why this library now isn't in boost? It's approvement in progress, or some serious problems with it?
-
stijn almost 13 yearsI 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 almost 13 yearsIt 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 almost 13 years@Ralf, could you give me link for this message(with reason) please?
-
Ralf almost 13 yearsSee lists.boost.org/boost-announce/2010/03/0256.php and the recent discussion comments.gmane.org/gmane.comp.lib.boost.devel/217266
-
Olympian almost 13 yearsYes, i watch this library. It's easy, but to young - i'm afraid there are some bad bugs:(
-
Olympian almost 13 yearsThank you very much. We decide to risk and try this library:)
-
Evan Nagle over 10 yearsPantheios 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 over 10 yearsUpdated a url, boost::log became a part of official boost release with version 1.54.0
-
Paweł Szczur over 10 yearsglog 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 over 7 yearsdoes things change in 2016?
-
Martin about 6 years@athos No, these issues are still present in 2018.
-
Craig S. Anderson about 6 yearsglog also lacks a DEBUG level, which most other logging libraries have.
-
andreee over 5 yearsI'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).