Inspired by the Panthios performance comparison, I've concocted my own performance test to decide what should I use: rlog or log4cxx. The test was also good to better understand the two libs and see what's the complexity to achieve similar results with them.
Instead of the tests from Pantheios, I've used these:
- Scenario 0 No Logging (used to get a reference for the other tests)
- Scenario 1 A single string.
- Scenario 2 Several string instances
- Scenario 3 Several numeric type instances.
- Scenario 4 A custom type `Person`.
- Scenario 5 A composite scenario, based on the previous scenarios.
- Scenario 6 Multiple log channels, instantiated by a large number of objects, with messages only on a couple of channels (this should indicate the impact of having a new log channel defined in each class)
Each test was also repeated for 2 types of logging formats: ttcc (this uses the TTCC log class from Log4cxx) and rlog (this uses a custom format logger from Log4cxx that outputs a text similar with that generated by rlog).
Though rlog was always almost twice as fast compared with log4cxx, in the end I'll go with log4cxx because:
- support for wide chars (not needed now, but nice to have)
- text formatting is much more flexible and C++ style
- more storage formats
- I liked more the way I've been able to add logging at class level (this is personal, I know, and somebody might get a simpler and nicer way to add rlog to a class than I was able to)
Here are the benchmark results: