I\'ve been trying for about 2 weeks now to get a logging library to work with. I\'ve tried Log4cxx, Log4cpp, log4cplus and boost.log. The problem isn\'t that none of these wor
I managed to get log4cxx to work, this was done in Visual Studios 2013 running on Windows 7 OS.
This following is what I did, step by step:
Download the log4cxx ZIP package extract its contents, http://logging.apache.org/log4cxx/download.html
Download apr and apr-util ZIP packages, http://apr.apache.org/download.cgi
Then
- manually extract this zip apr-1.2.11-win32-src.zip (the extracted folder should be named 'apr', if it is not manually rename it)
- manually extract this zip apr-util-1.2.10-win32-src.zip (the extracted folder should be named 'apr-util', if it is not manually rename it)
- open a command prompt and run the following: cd apache-log4cxx-0.10.0 configure (this will execute configure.bat)
We will need to disable to use of the APR ICONV and LDAP support. In order to do so, we will append the following files manually:
- Open apr-util\include\apu.hw. Find the line starting with “#define APU_HAVE_APR_ICONV”. Change the value to 0 and save.
- Open apr-util\include\apr_ldap.hw. Find the line starting with “#define APR_HAS_LDAP” Change the value to 0 and save.
We need to build the log4cxx.dll, to do so convert *.dsw to *.cxproj.
- Launch Visual Studio 2013 and open log4cxx.dsw.
- VS will ask if you like to convert everything. Simply click Yes. There may be some warnings in the migration report, but nothing that should prevent the solution from opening.
> The projects xml, apr, and apr-util should build successfully.
If you try compiling the log4cxx project it will most likely fail with hundreds of errors. This is due to a bug in VC++ which can be worked around.
- Move all macros outside (above) the class they are in. LOG4CXX_LIST_DEF macro is used to define classes. All macros reported in error C2252 will need to move out of any classes. This may also include moving definitions which are used in the macro.
- Next, change all LoggingEvent::KeySet to KeySet (this is no longer nested in a parent class)
> Following this, the log4cxx project should now compile successfully on your machine.