Apache Log4CXX is a logging framework for C++ patterned after Apache log4j. It also happens to be quite difficult to build on Windows if you are using Microsoft Windows SDK 1.0 (AKA Microsoft Platform SDK 6.0). If you are building software for Windows Vista or Windows Server 2008, or using Visual C++ 2008, you are using Windows SDK 1.0.
The reason Log4CXX 0.10.0 is hard to compile with Windows SDK 1.0 is a bug in APR 1.2.12 (the latest version available as of this writing) and a bug in Windows SDK 1.0 itself (a preprocessor redefinition due to including twice a header file). Here comes the recipe in case you want to build the stuff yourself:
- Download APR 1.2.12 and extract it. Rename to apr.
- Download APR Util 1.2.12 and extract it. Rename to apr-util.
- Download Log4CXX 0.10.0 and extract it
- Download GNU Sed and install it
- Open cmd.exe and run %PROGRAMFILES%Microsoft Visual Studio 9.0VCvcvarsall.bat
- Apply the apr-1.2.12-win32.patch patch to fix bug 40398 in APR 1.2.12 (this step is not needed if you are using APR 1.2.13)
- Apply the log4cxx-0.10.0-vc90-support.patch patch
- Enter directory apache-log4cxx-0.10.0
- Execute configure.bat
- Execute configure-aprutil.bat
- Open the log4cxx.dsw solution When asked to convert the solution to VC++9, click Yes to All.
- Right click on Solution log4cxx and select Build solution
I’m using the log4cxx.dll in my Eclipse RCP application, I have an another dll which been used by the RCP application, it is invoking the log4cxx call for logging.
All works fine and I’able to get the logs(Thanks to Merc.. http://www.dreamcubes.com/blog/index.php?itemid=43#nucleus_cf). The only issue I find is, when I exit the RCP application, always the log4cxx dll is crashing. I tried multiple combination’s, but still I haven’t get it fixed. Any help would be greatly welcome.
Thanks and Regards,
How are the patches applied i.e. where should the patch file be copied and what is the command? I’m using GNU patch in DOS with no luck, getting the “can’t find file to patch..” message :/
Use “patch -p1 -d log4cxxdirectory” to make sure patch uses the right directory.
In case GNU Patch crashes on Windows, convert the line endings (use tofrodos).