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”/>
<filter class=”org.apache.log4j.varia.LevelRangeFilter”>
<param name=”LevelMin” value=”DEBUG” />
<param name=”LevelMax” value=”FATAL” />

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

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


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.