tags:

views:

1132

answers:

7

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
+3  A: 

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

http://sourceforge.net/projects/log4cplus/
http://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.

Casey
I don't like those libraries. They have memory leaks. And the log4cxx requires 5 other apache things in order to get built.
m_pGladiator
A: 

As always, Boost proposes a full-flesh library: Boost.Logging

-> It allows runtime configuration, so you could plug a CLI on it.

But as usual, there is neither a GUI nor a CLI to begin with.

Note that the GUI bit is a bit more difficult to achieve. We have one at work (as well as our own logging framework), but of course they are proprietary so I won't be able to give you any code.

I can tell though (safely I think) that the GUI think is nothing more than a log parser. Since all application log with the same format, the GUI parses the necessary log files when you request it.

I know an intern worked on exploiting the logs: basically parsing and then structure them in a DB with some 'tag' indexing, but I haven't heard about it officially so I fear it went to the trash bin as soon as the internship ended. Too bad because the ability to index messages given a predefined set of tags was really helpful when you are looking for a particular log...

Matthieu M.
A precision: The library you refer to is not an official Boost library. It is *proposed* for inclusion into Boost, but not yet reviewed. And there is another Boost.Log proposal in the review queue, by Andrey Semashev: http://boost-log.sourceforge.net/libs/log/doc/html/index.html
Éric Malenfant
A: 

log4cxx is what i prefer

aajkaltak
+3  A: 

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

ossandcad
A: 

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.).

nhaa123
+2  A: 

This doesn't directly answer your quesiton, but I wonder whether you care about performance. If you do, I'd echo ossancad and 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 applicaiton code.

JamieH
+2  A: 

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).

dcw