Log4j Configuration

The following document covers using Log4j with JBoss Application Server:http://docs.jboss.org/jbossas/logging/JBossLog4j.pdf. This document states: “If you need to modify the log4j setup to add your category configuration, you must modify the JBoss server log4j configuration file to add this information.” Basically this means the log4j file that comes with JBoss will need to be modified to include the Expere information, instead of using the log4j.xml that comes with Expere.

JBoss uses Log4j for its internal logging, and by default the JBoss specific CONSOLE appender threshold is set to INFO. New appenders can be added for the Expere specific logging. If this is not done Expere logging statements at INFO will be logged along with the JBoss logging to the console. The example below creates an Expere specific Console and File appender set to FATAL.

The JBoss log4j configuration files are at \server\default\conf\log4j.xml (jboss-4.0.5.GA) or \server\default\conf\jboss-log4j.xml (jboss-4.2.3.GA and jboss-5.0.1.GA). Add the following text to the appender section of the log4j configuration:

<appender name = "ExpereRequests" class="org.apache.log4j.RollingFileAppender">
 <param name="File" value="${jboss.server.log.dir}/ExpereIEServicesRequests.log"/>
 <param name="MaxFileSize"value="5MB"/>
 <param name="MaxBackupIndex"value="3"/>
 <param name="DatePattern"value="'.'yyyy-MM-dd"/>
 <param name="Append"value="true"/>
 <param name="Threshold"value="DEBUG"/>
 <layout class="org.apache.log4j.PatternLayout">
 <param name="ConversionPattern"value="%d%-5p[%c]%m%n"/>
 </layout>
</appender>

Add the following text to the category section of the log4j configuration. Setting the additivity attribute to false ensures that Expere log statements which are set above debug are not sent to the JBoss CONSOLE appender, which is referenced from the root logger.

<!-- Specific to WKFS Packages --> 
 <category name="com.bankerssystems" additivity="false"> 
 <priority value="FATAL"/> 
 <appender-ref ref="WkLog"/>
 <appender-ref ref="WkConsole"/> </category>
<!-- Logging for utilization messages -->
 <!--
 Enabling the info level for this will cause one entry for each request
 and response to be written to the log. Debug level will provide an
 additional entry for each request and response and will write out the
 entire request/response to the logs.
 -->
 <!--
 <category name="com.bankerssystems.expere.utilization.requests" additivity="false">
 <priority value="debug"/>
 <appender-ref ref="CONSOLE"/>
 <appender-ref ref="ExpereRequests"/>
 </category>
 <category name="com.bankerssystems.expere.utilization.responses" additivity="false">
 <priority value="debug"/>
 <appender-ref ref="CONSOLE"/>
 <appender-ref ref="ExpereRequests"/>
 </category>
 -->
 <!--
 Enabling the info level for this will cause one entry for each request
 that errors to be written to the log. Debug level will provide an
 additional entry for each request that fails and will write out the
 entire request to the log.
 -->
 <!—
 <category name="com.bankerssystems.expere.utilization.errors.requests" additivity="false">
 <priority value="debug"/>
 <appender-ref ref="CONSOLE"/>
 <appender-ref ref="ExpereRequests"/>
 </category>
 -->
 <!--
 Enabling the following will cause the stack traces for all errors to be written to the ExpereRequests log.
 -->
 <!—
 <category name="com.bankerssystems.expere.utilization.errors" additivity="false">
 <priority value="debug"/>
 <appender-ref ref="CONSOLE"/>
 <appender-ref ref="ExpereRequests"/>
</category>