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 class 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):
Output (partial):