Tech > JbossLog4J

Configuring Log4j for JBoss

This guide relates to version 3.0.6 of JBoss. It describes how to amend the log4j configuration supplied with JBoss in order to include logging information from your own application.

  • Edit ../server/xxx/conf/log4j.xml
  • Find the <appender> attribute named "FILE"
  • Amend the value of the <param> attribute named "Threshold" from "INFO" to "DEBUG". This increases the level of logging to the server log file to include everything (including JBoss debug).
  • Similarly change the entries for the <appender> attribute named "CONSOLE". This increases the level of logging output to the JBoss console.
  • Find the <category> attribute named "org.jboss". This entry is commented out. Remove the comments so that the "org.jboss" category only logs "INFO" or perhaps only "WARN", thereby reversing the effect of changing the global threshold to "DEBUG" on jboss logging. Note that servlet debug output is included in the log under the "INFO" category, so if you set it to "WARN" you will not see any debug output from your servlets. See StrutsHints for information of Struts logging.
  • Add your own <category> attribute. E.g.

    <!-- Limit com.mydomain categories to DEBUG -->
    <category name="com.mydomain">
     <priority value="DEBUG"/>
  • Restart the JBoss server to implement the new log4j configuration or wait for the JBoss timer task to catch the changes.

-- Frank Dean - 10 June 2003