Search code examples
javawindowsloggingevent-log

How to write from Java to the Windows Event Log?


How can I write from Java to the Windows Event Log?


Solution

  • EDIT (2023): See JNA https://stackoverflow.com/a/3815771/3937

    Old answer

    Log4J is a Java-based logging utility. The class NTEventLogAppender can be used to "append to the NT event log system". See the documentation here:

    http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/nt/NTEventLogAppender.html

    Edit: There is a newer version, Log4j 2 "that provides significant improvements over its predecessor."