1 Reply Latest reply on Feb 28, 2011 1:52 AM by saurvals

    Facing issue with Logging in JBoss 5

    saurvals

      Hi All,

       

      We have ported our product from Jboss 4 to Jboss 5.

       

      Earlier in Jboss 4,we were able to set our application related logging using %JAVA_HOME%/jre/lib/logging.properties file.

      But in Jboss 5 it is not working.

      Even after setting the following system properties its not working:

      -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.jdk.JDK14LoggerPlugin

      -Djava.util.logging.config.file=logging.properties

       

      Our application uses java.util.logging.Logger and we want way to force the Jboss 5 to use JDK Logger.

       

      Cerating category in the jboss-log4j.xml is also not working for us.

      If we cerate like this:

      <category name="com.bmc.patrol.portal.rsmcommunication.patsdk.RSMCommunicationServiceImpl">

      <priority value="FINEST"/>

      </category>

       

      It only prints the FINE level log messages and the FINEST level log messages.

      Please let us know if there is some setting which needs to be done to make this work.


      Let me know if more details are required.

       

      Thanks,

      Saurabh V.

        • 1. Facing issue with Logging in JBoss 5
          saurvals

          Finnaly the issue is resolved. With Jboss 5 onwards to make your jdk level working you need following things.

           

          1) Instead of specifying the class/package in logging.properties specify these in jboss-log4j.xml in profile/conf directory.

          2) Add a appender for trace level for e.g.

          <!-- A size based file rolling appender need to be used only for FINEST level  -->
             <appender name="FILE-TRACE" class="org.jboss.logging.appender.RollingFileAppender">
               <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
               <param name="Threshold" value="TRACE"/>
               <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
               <param name="Append" value="true"/>
               <param name="MaxFileSize" value="10MB"/>
               <param name="MaxBackupIndex" value="10"/>

               <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="&lt;%5.1p,%d{MM/dd/yy HH:mm:ss z},%c{1}> %m%n"/>
               </layout>    
             </appender>

          3) Add a category for class/package in the same jboss-log4j.xml file as below:

           

          <category name="com.test.sample.ABC" additivity="false">

             <priority value="FINEST" class="org.jboss.logging.log4j.JDKLevel"/>

             <appender-ref ref="FILE-TRACE"/>

             </category>

           

          Doing this enabled the FINEST level logging for Jboss 5 +, I hope this helps.

           

          Thanks,

          Saurabh V.