4 Replies Latest reply on Feb 15, 2013 9:28 AM by Peter Saly

    JBoss 7 AS with slf4j-log4j  and  log4j.xml in the application

    kumaran d Newbie

      Hi all,,

       

      we are in the process of upgrading our application server from JBoss 5.1.0GA to the latest. we have tested a sample CDI application with JBoss 6.0 AS and now we are trying to deploy the same application in Jboss 7 AS, but the slf4j-log4j logging is not working and the FileAppender is not able to find.

       

      sample application with CDI Interceptor and it works fine and I am using the standalone version

       

      In our  application we are using slf4j with slf4j-log4j binder so i have added manually slf4j-log4j12 module to JBoss 7AS (jboss-as-7.0.0.Final\modules\org\slf4j\slf4j-log4j12\main),  and  added in our application war file MENI-FEST for org.slf4j.slf4j-log4j12 dependencies.   In debug mode i could able see log4j binding is happening (org.slf4j.impl.Log4jLoggerAdapter).

       

      so current issue is that i have log4j.xml in my application WEB-INF\  folder and it's not able load and log into the specified File.  i have customized the log4j PatternLayout to CustomPatternLayout.

       

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

              <param name="file" value="D:/server/log/sampleApp.log" />

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

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

              <layout class="com.sample.log4j.layout.CustomPatternLayout">

                  <param name="ConversionPattern" value="%p %t %c - %m%n" />

              </layout>

          </appender>

       

          <category name="org.weld">

              <priority value="DEBUG" />

              <appender-ref ref="R" />

          </category>

       

          <root>

              <priority value="debug" />

              <appender-ref ref="R" />

          </root>

       

       

      Please help us in resolving this slf4j-log4j logging Issue.