Logging

Tomcat Access Logs

In server/default/deploy/jboss-web.sar/server.xml look for the commented out access logger (search for "Access logger").

Replace

            <!--
            <Valve className="org.apache.catalina.valves.AccessLogValve"
                prefix="localhost_access_log." suffix=".log"
                pattern="common" directory="${jboss.server.log.dir}" 
                resolveHosts="false" />
            -->

with the following:

            <Valve className="org.apache.catalina.valves.AccessLogValve"
                prefix="localhost_access_log." suffix=".log"
                pattern="common" directory="${jboss.server.log.dir}" 
                resolveHosts="false" 
                fileDateFormat="'.'yyyy-MM-dd" />

Setting logging levels

During development and configuration seeing more debugging information on the console and the logs is very useul.

The log configuration is in server/default/conf/jboss-log4j.xml and uses a system property to set the console log level.

You can pass the -Djboss.server.log.threshold=DEBUG parameter while starting the server:

./run.sh -c default -Djboss.server.log.threshold=DEBUG

Added a category to conf/jboss-log4j.xml

   <category name="org.bedework">
     <priority value="${jboss.server.log.threshold}" />
   </category>

Also changed the console appender

   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="Target" value="System.out"/>
      <param name="Threshold" value="${jboss.server.log.threshold}"/>

      <layout class="org.apache.log4j.PatternLayout">
         <!-- The default pattern: Date Priority [Category] Message\n -->
         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
      </layout>
   </appender>

You're now flooded with jboss output so uncommented out the setting of the jboss level:

   <!-- Limit JBoss categories -->
   <category name="org.jboss">
      <priority value="INFO"/>
   </category>

and remove this

   <category name="org.bedework">
     <priority value="${jboss.server.log.threshold}" />
   </category>

Hibernate is very noisy too so

   <!-- Limit hibernate categories -->
   <category name="org.hibernate">
      <priority value="INFO"/>
   </category>

and these

   <!-- Some other noisy components -->
   <category name="com.arjuna">
      <priority value="INFO"/>
   </category>

   <category name="net.sf.ehcache">
      <priority value="INFO"/>
   </category>

   <category name="org.ajax4jsf">
      <priority value="INFO"/>
   </category>

   <category name="org.springframework">
      <priority value="INFO"/>
   </category>

   <category name="facelets">
      <priority value="INFO"/>
   </category>