Describe NTEventLogAppender here. Log4j NT Event log setup

=============================

JavaDocs

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

=============================
Log4j.xml setup - Example

      <appender name="NT_LOG" class="org.apache.log4j.nt.NTEventLogAppender">
          <param name="Source" value="demo"/>
          <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
                  value="%-5p-%d{dd MMM yyyy-HH:mm:ss,SSS}-%C.%M:%L)%m%n"/>
          </layout>
      </appender>

=============================

DLL Setup Get the .zip file for your version of log4j (i.e. 1.2.17) and download the .zip file (NOT the .jar file)

[http://archive.apache.org/dist/logging/log4j/1.2.17/]

Open the .zip file and ...

Copy the appropriate dll into the %SystemRoot%\System32 folder

For 64-bit OS
%SystemRoot%\System32\NTEventLogAppender.amd64.dll

For 32-bit OS
%SystemRoot%\System32\NTEventLogAppender.dll

=============================

Regedit setup Create a new “Key” here:

HKLM\SYSTEM\CurrentControlSet\services\eventlog\Application\<APPLICATION_NAME>

Create a new “String”
EventMessageFile = <dll name>

For 64-bit OS EventMessageFile = %SystemRoot%\System32\NTEventLogAppender.amd64.dll

For 32-bit OS EventMessageFile = %SystemRoot%\System32\NTEventLogAppender.dll

Misc. links:

[http://code.dblock.org/log4jna-log4jerror-could-not-register-event-source-access-is-denied]

[http://code.dblock.org/log4jna-the-description-for-event-id-4096-from-source-log4jna-cannot-be-found]

NT Event logger info.
[http://logging.apache.org/log4j/1.2/faq.html#a2.10 ]

  • No labels