NTEventLogAppender is not showing up in Windows Event Log
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jeremy_Mann
Posted On:   Thursday, May 5, 2005 06:26 PM

Below is my code for logging to the Event Log. It is not showing up however - does anyone know what I am doing wrong? I also don't know which event log it will write to. public void test() { // get a logger instance called "Log4JWindowsEvent" Logger myLogger = Logger.getLogger("Log4JWindowsNTEvent"); //Logger myLogger = DfLogger.getRootLogger(); //create layout Layout myLayout = new SimpleLayout(); // specify a source String mySource = "JAVA TEST"; // create an NTEventLogAppender NTEventLogAppender eventLogAppender   More>>

Below is my code for logging to the Event Log. It is not showing up however - does anyone know what I am doing wrong? I also don't know which event log it will write to.



public void test()

{

// get a logger instance called "Log4JWindowsEvent"

Logger myLogger = Logger.getLogger("Log4JWindowsNTEvent");

//Logger myLogger = DfLogger.getRootLogger();


//create layout

Layout myLayout = new SimpleLayout();


// specify a source

String mySource = "JAVA TEST";

// create an NTEventLogAppender

NTEventLogAppender eventLogAppender

= new NTEventLogAppender(mySource,myLayout);

// create a console appender

ConsoleAppender consoleAppender
= new ConsoleAppender(myLayout);

// associate the appenders to the logger

myLogger.addAppender(consoleAppender);

myLogger.addAppender(eventLogAppender);


// set the level of the logger

myLogger.setLevel(Level.INFO);


// log a fatal event

myLogger.info("This is a test");


}

   <<Less
About | Sitemap | Contact