Log4J NTEventLogAppender DLL not found
Hy ppl,
I'm having a problem trying to use Log4J's NTEventLogAppender.
I've set my Log4J properties like this:
log4j.rootLogger=DEBUG, CA, NTEventLog
#Console Appender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#File Appender
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.File=sample.log
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#Event Log Appender
log4j.appender.NTEventLog=org.apache.log4j.nt.NTEventLogAppender
log4j.appender.NTEventLog.source=ESB Web Services
# Set the logger level of File Appender to WARN
log4j.appender.FA.Threshold = WARN
Following the advice here, I've placed NTEventLogAppender.amd64.dll file on my System32 Folder, but when I try to instance a clas开发者_Python百科s that uses a Logger I get this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: NTEventLogAppender (Not found in java.library.path)
What's wrong here?
This is to allow you to debug easily:
If you did add the dll in the System32 folder, make sure that the directory is also included in Java's library path java.library.path
:
To test (via code):
System.out.println(System.getProperty("java.library.path"));
Output (partial):
C:\Program Files\Java\jdk1.6.0_21\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Borland\Delphi7\Bin;C:\Program Files\Borland\Delphi7\Projects\Bpl\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\RemObjects Software\Everwood\Bin;C:\Program Files\RemObjects Software\RemObjects SDK for Delphi\Dcu\D7;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Embarcadero\Delphi Prism\bin;C:\Program Files\Developer Express.VCL\Library\Delphi14;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Developer Express.VCL\Library\Delphi7
Despite having the System32 on my java build path, I've placed it on:
C:\Program Files (x86)\IBM\WID7_WTE\runtimes\bi_v7\java\jre\bin
That also was on my build path and finally got it working
Thanks!
精彩评论