3 Replies Latest reply on Aug 3, 2012 12:30 PM by Wolf-Dieter Fink

    How to set my app level log4j to use JBoss Log levels

    Elangovan Shanmugam Newbie

      Hi, Might be a simple question. But I could not find the answer. I am using JBoss AS 7.1. Slf4j with Log4j as provider.


      I have a log4j.xml in my war, as simple as,

          <appender name="R" class="org.apache.log4j.RollingFileAppender">

              <param name="file" value="${jboss.server.log.dir}/loghubtest.log"/>

              <param name="MaxFileSize" value="100KB"/>

              <param name="MaxBackupIndex" value="10"/>

              <layout class="org.apache.log4j.PatternLayout">

                  <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>





          <category name="com.intuit.loghub">

              <priority value="${jboss.server.log.threshold:INFO}"/>

              <appender-ref ref="R"/>




          <!-- ======================= -->

          <!-- Setup the Root category -->

          <!-- ======================= -->





                Set the root logger priority via a system property. Note this is parsed by log4j,

                so the full JBoss system property format is not supported; e.g.

                setting a default via ${jboss.server.log.threshold:WARN} will not work.


              <priority value="${jboss.server.log.threshold:INFO}"/>  <!---- this is not working as mentioned in the above comment. This used to work in the previous version JBoss.  -->

              <appender-ref ref="R"/>



      Obviously, If I hardcode my log level (INFO, DEBUG, etc.) it logs per the level hardcoded. If I want to use control using JBoss log level or JBoss admin console, how do I set. Please help.


      Thanks in advance.