I have two applications deployed to the same profile on websphere server, they both need to log information to windows event log using log4j. First, I set up the log4j as a shared library, then reference the shared library from both applications and copy the NTEventLogAppender.dll to the windows\system32. It works well when I use "org.apache.log4j.DailyRollingFileAppender" as appender in the configuration file, I can see the new entry logged in the log file. but after I changed to "org.apache.log4j.nt.NTEventLogAppender", I got the error:
By research on interent, I understand this is because the NTEventLogAppender.dll, as a native dll file, is not controlled by websphere server. To avoid this error, it is my responsibility to ensure the dll is only loaded once. There is also an example on the internet to show how to create an utility JAR file and load the native dll file, then set up it as shared library. But with log4j I have no idea how to do this. I have spent lots of time trying to figure out, but still no luck . Could anyone please advise? Any help will be highly appreciated!