I've been testing three options for my logging subsystem in C++. One is Log4cplus, one is Pantheios and the last one is a simple logging library that we have written ourselves.
Log4cplus has been much slower than the other two. Here are the results for logging 1,000,000 log entries:
I'm wondering if I'm missing any performance tuning.
I should add that I'm always using the root logger, I'm logging to file and logging:
LOG4CPLUS_INFO(rootLogger, "Replace me with the text!");
thanks, Reza
Using log4cplus::NullAppender
in the performance_test
gives me Logging 1000000 took: 4sec 343709usec
on semi-loaded FreeBSD server. IOW, the pure logging overhead is rather small. Your logging timings seem to depend on the target logger. If you are using log4cplus::FileAppender
, the timings will be significantly different.
EDIT:
You need to tune the FileAppender
a little bit. Make sure that you set the ImmediateFlush
property to false. You could also set up BufferSize
to something bigger, like 1000000 bytes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With