Recently, a couple ofarticles about logging libraries for C ++ flashed on Habré. The articles are good and intelligible, the author respects. But personally, I do not understand the following things:
How can I use the library, the development of which was abandoned many years ago (log4cxx)?
Why does the library of logging depend on other libraries (log4cxx, Pantheios)?
How can you not have such basic functionality as Rolling Files ? (Pantheios)
Why does the logging library need such dimensions (log4cxx - in the amount of 4.1 MB in the archive, Pantheios - 9.3 MB in the archive)?
Why, when compiling the logging library, should I clean ~ 300 errors (log4cxx)?
Therefore, I decided to talk about a library such as log4cplus , which has:
The last stable release was released in 2011, there is an active tracker and constant commits to the repository
There are a lot of mechanisms for logging (Rolling Files alone - 2 types)
No external dependencies
The total size of the source code in the archive is 420 Kb (this is with documentation, tests and examples)
Included are ready projects for different platforms that are compiled without errors.
Screws to the project in less than 5 minutes
I, as in previous articles, will describe the use of this library in Microsoft Visual Studio 2010 sp1.
We put log4cplusU.dll (it was compiled at the 4th step) next to the exe-file of the test project.
We start. We see in the console the output of our logger.
PROFIT!
Then you can start picking config files, writing your appenders and layouts, etc. Who cares - here is a slightly deeper article about these things. And here are a couple of examples .