C++ logging framework suggestions

C++Logging

C++ Problem Overview


I'm looking for a C++ logging framework with the following features:

  • logs have a severity (info, warning, error, critical, etc)
  • logs are tagged with a module name
  • framework has a UI (or CLI) to configure for which modules we will actually log to file, and the minimum severity required for a log to be written to file.
  • has a viewer which lets me search per module, severity, module name, error name, etc

C++ Solutions


Solution 1 - C++

Not sure about the configuration from a UI or CLI. I've used both of these logging frameworks at one point or other.

https://sourceforge.net/projects/log4cplus/
https://logging.apache.org/log4cxx/index.html

It wouldn't be too hard to drive your logging based on a configuration file that could be editable by hand or through a quick and dirty GUI or CLI app. Might be a bit harder to adjust these dynamically but not too bad.

Update:

It looks like the proposed Boost.Log is now in Boost 1.54 which is at a stable release. If you are already using Boost than I would take a look at it.

Solution 2 - C++

No viewer but you could try pantheios. I have been using it for almost a year now and am quite happy with it.

Solution 3 - C++

I strongly suggest Pantheios, as it's the only one that's completely type-safe, and is also very efficient. It imposes a little work on the user, in selecting the right "front-end" and "back-end", but once you've got it working, you can just fix and forget.

It doesn't provide sophisticated logging facilities - e.g. rolling files - but that's by design, because it's intended to be used in combination with other logging libraries that have more functionality (but poorer performance / type-safety).

Solution 4 - C++

If you care about performance, I suggest you check out Pantheios. In particular, it's got very high performance, and it can be used in combination with other logging libraries -- it acts as an efficient and type-safe layer between the logging library (such as log4cxx) and your application code.

Solution 5 - C++

You could use wxWidgets and use it's excellent class for logging. It's rather easy and straightforward. For instance, you can create a dialog which gathers all your logs (e.g. wxLogError, wxLogMessage, wxLogDebug, etc.).

Solution 6 - C++

Pantheios is a good candidate in term of perormance but my personal preference is P7 library. My internal tests (CPU i7-4870HQ, SSD) shows that P7 is faster than Pantheios.

  • Pantheios writes 1.8M logs lines per second (time & text message)
  • P7 writes 2.4M logs lines per second (time, thread, CPU core, function, file, line and text message)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionWarpinView Question on Stackoverflow
Solution 1 - C++CaseyView Answer on Stackoverflow
Solution 2 - C++ossandcadView Answer on Stackoverflow
Solution 3 - C++dcwView Answer on Stackoverflow
Solution 4 - C++JamieHView Answer on Stackoverflow
Solution 5 - C++nhaa123View Answer on Stackoverflow
Solution 6 - C++IgorView Answer on Stackoverflow