Logging for C++

Our main apps write a log file to the local disk. This comes in handy when diagnosing bugs in the code. Some time this year, we had a bug. A manager thought we could look at the log to figure out the source. Well the log is not comprehensive. We just log things we think we might need. Now we are on the hook to add more logging!

A couple other manager types got involved. Their answer? Log4j! Well out code is written in C++. The managers said we should just implement the Log4j equivalent for C++. Hold on there partner. If we are going to add in a logging framework, shouldn't we check what is out there first? Yes indeed. I decided to look into the matter one afternoon. Here is what I found.

While there were many options to choose from, I found the most information on log4cxx, log4cplus, log4cpp, glog, and Pantheios. I paid attention to the license type each framework is released under. Also was interested in whether the framework is still being maintained.

Log4cxx is an Apache project. The config files match log4j. The project is being actively maintained. Log4cplus is a port of log4j. There is no a lot of documentation available for this project. Log4cpp is released under the LGPL. It is not an actively maintained project. It also goes by the name "Log for C++". Glog stands for Google Log. It is new, and is based on streams plus macros. It is released under a BSD license. It is thread safe. Pantheios is open source and type safe. It is recommended for large apps. It is simple to use. It is released under a BSD license.