This discussion is archived
1 Reply Latest reply: Feb 4, 2013 2:00 AM by 988058 RSS

NTEventLogAppender java.lang.UnsatisfiedLinkError

988058 Newbie
Currently Being Moderated
Hi,

I have written sample program for writing Windows Event logs using log4j NTEventLogAppender. I have copied NTEventLogAppender.dll into windows system path. But when i run this program i am getting java.lang.UnsatisfiedLinkError. I think this dll is wrong. NTEventLogAppender is trying to load NTEventLogAppender.x86.dll but this is not available. When i download Log4j-1.2.17 i got only these two dlls NTEventLogAppender.dll, NTEventLogAppender.amd64.dll, I could not found x86.dll in Apache Logging Services

Can some one suggest what is wrong in my program and where can i get NTEventLogAppender.x86.dll?

Log4j version is : Log4j-1.2.17

Sample program:

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.nt.NTEventLogAppender;


public class Log4jTest {
static final Logger ntLogger = Logger.getLogger("Log4NTEvent");

public static void main(String[] args) {
PatternLayout myLayout = new PatternLayout("%-4r [%t] %-5p %c %x - %m%n");
try {
NTEventLogAppender eventLogAppender = new NTEventLogAppender("Log4j", myLayout);
ntLogger.addAppender(eventLogAppender);
ntLogger.setAdditivity(false);
ntLogger.setLevel(Level.ALL);
System.out.println("Successfully initialized NTEventLogAppender :-)");
} catch(java.lang.UnsatisfiedLinkError e) {
System.out.println("Initialization Failed for NTEventLogAppender :-( "+e);
}
}

}

Error

.java.lang.UnsatisfiedLinkError: org.apache.log4j.nt.NTEventLogAppender.registerEve ntSource(Ljava/lang/String;Ljava/lang/String;)I

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points