How to write to the Windows event log from BW through log4j.

How to write to the Windows event log from BW through log4j.

book

Article ID: KB0088005

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
Resolution: All files referred to are located in the attached file windows_event_log.zip.

1). Modify <TIBCO_HOME>\bw\5.9\lib\log4j.xml by adding new logger and appender . See the attached file log4j.xml.

----------------------
<appender name="NTEvent" class="org.apache.log4j.nt.NTEventLogAppender">
<param name="source" value="SomeServiceName" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n" />
</layout>
</appender>

<logger name="bw.mylogger">
    <level value ="INFO"/>
    <appender-ref ref="NTEvent"/>
</logger>
----------------------

The logger and appender  were named “bw.mylogger” and “NTEvent” separately.

2). Download log4j from http://logging.apache.org/log4j/1.2/ .  Unzip the file and copy NTEventLogAppender.dll to %SYSTEMROOT%\SYSTEM32 .

Also attached is the file NTEventLogAppender.dll and we recommend you download yourself.

3). See the attached demo project.


Note: The default event ID is 4096. It appears there is no way to modify it. As an alternative, the Windows command “eventcreate” can be used along with "External Command" activity.

Issue/Introduction

How to write to the Windows event log from BW through log4j.

Attachments

How to write to the Windows event log from BW through log4j. get_app