What is the most efficient thread-safe C++ logger?

Viewed 85071

I am working on a performance critical multi-threaded application. I looked at rlog, Ace and Boost logging. I chose rlog because I read it was the fastest (when logging is disabled, it has the least overhead).

The problem I have is it shows the file name, line number etc. even in release mode. If you can tell me how to shut that information off, my problem might be solved. In any case what is the most efficient logger in C++ for my situation?

9 Answers

I've had success with log4cxx at http://logging.apache.org/log4cxx/index.html. It's a C++ version of the popular Log4j logger, is easy to configure either via a conf file or in the code. The overhead when it is disabled is minimal (method call and integer compare).

The pattern for the output to the log is defined by a conversion pattern that can be as simple as the date/time and a message. It also handles file size limitation, rollover, etc. You can also configure different patterns for various errors and sources.

Some of the overhead may happen in your macros/streams. You need to be very careful not to compose the string being logged when the logging is disabled.

Clever use of streams and ?: operator allows you to do that, as do macros.

maybe pantheios
though I don't know if it's thread-safe or not...

Related