JBoss LOG4J Configuration

LOG4J Configuration

Step 1:
JBoss wont load custom log files from ear or war files.
If required we need to load them from code explicitly. This is ruled out.
Default it loads file from jboss4serverdefaultconfjboss-log4j.xml file

<appender name=”ABCD_FILE” class=”org.apache.log4j.RollingFileAppender”>
<errorHandler class=”org.jboss.logging.util.OnlyOnceErrorHandler”/>
<!– param name=”File” value=”${jboss.server.home.dir}/log/ABCDApplication.log”/ –>

<param name=”File” value=”/jboss4/server/default/log/ABCDApplication.log”/>
<param name=”MaxFileSize” value=”5000KB”/>
<param name=”MaxBackupIndex” value=”3″/>

<layout class=”org.apache.log4j.PatternLayout”>
<param name=”ConversionPattern” value=”%d %-5p [%c] %m%n”/>
</layout>
<filter class=”org.apache.log4j.varia.LevelRangeFilter”>
<param name=”LevelMin” value=”DEBUG” />
<param name=”LevelMax” value=”FATAL” />
</filter>

</appender>
Keep this section above root level (<root>).
<category name=”com.ABCD”>
<priority value=”DEBUG”/>
<appender-ref ref=”ABCD_FILE”/>
</category>

Step 2:
ABCDApplication/log4jAdmin.jsp to configure at runtime and view
Search in google for log4jAdmin.jsp file.

Advertisements