用Java读取Windows EventLog的方法
时间:2020-03-05 18:57:21 来源:igfitidea点击:
是否有人在不使用JNI的情况下如何读取Windows EventLog的任何指针?或者,如果我们必须使用JNI,是否有任何好的开放源代码库?
解决方案
回答
http://bloggingabout.net/blogs/wellink/archive/2005/04/08/3289.aspx
和
http://www.j-interop.org/
回答
我们将需要使用JNI。
回答
我们可能需要考虑使用J / Invoke或者JNA(Java Native Access)作为备受be病的JNI的替代方案。
回答
JNA 3.2.8同时具有所有事件记录功能的实现和Java迭代器。读这个。
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()); }