tags:

views:

1101

answers:

4

Does anyone have any pointers on how to read the Windows EventLog without using JNI? Or if you have to use JNI, are there any good open-source libraries for doing so?

+1  A: 

http://bloggingabout.net/blogs/wellink/archive/2005/04/08/3289.aspx and http://www.j-interop.org/

Sanjaya R
A: 

You'll need to use JNI.

Flint
+1  A: 

You may want to consider looking at J/Invoke or JNA (Java Native Access) as an alternative to the much berated JNI.

Cheekysoft
A: 

JNA 3.2.8 has both an implementation for all event logging functions and a Java iterator. Read this.

EventLogIterator iter = new EventLogIterator("Application");         
while(iter.hasNext()) { 
    EventLogRecord record = iter.next(); 
    System.out.println(record.getRecordId() 
            + ": Event ID: " + record.getEventId() 
            + ", Event Type: " + record.getType() 
            + ", Event Source: " + record.getSource()); 
} 
dblock