JBoss Community

Jboss log4j level dynamic switch

created by Pradeep Sreekumar in JBoss Web Development - View the full discussion

Hi All,

I am having an issue with switching the log level dynamically.I tried using log4j xml and following is the log4j configuration.

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

 

      <param name="File" value="${jboss.server.log.dir}/shcapiTest.log"/>
      <param name="Threshold" value="INFO"/>
      <param name="Append" value="false"/>

 

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

<category name="com.test.api" additivity="false">
        <appender-ref ref="FILE"/>
       </category>

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

 

Also RefreshPeriod is configured in jboss-service.xml.

But changing the threshold level from INFO to DEBUG is not printing my DEBUG logs

 

This is how i access the logger

Logger
            .getLogger("com.test.api");

logger.debug("Testing debug");

Any issue with this configuration.?

Reply to this message by going to Community

Start a new discussion in JBoss Web Development at Community