3 Replies Latest reply on Dec 27, 2007 6:42 AM by grace777

    log4j with jboss issue ?

    Jasdeep Newbie

      I tried to use log4j with my web application deployed on JBoss..
      but JBoss did not permit it . so i configured JBoss logging in my application as in this link :http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigureLogging...

      Every thing worked fine , but now i want to use MDC( mapped diagnostic context ) technique of log4j in my application .. which is not permitted in JBoss logging..

      So to configure log4j loging support i did following :
      1.Renamed log4j.xml in JBOSS_HOME/server/default/conf to jboss-log4j.xml
      2.Changed jboss-service.xml in JBOSS_HOME/server/default/conf accordingly to tell JBoss to use jboss-log4j.xml
      3. Added following code jboss-web.xml

      <class-loading java2ClassLoadingCompliance="false">
       <loader-repository>
       testlogapp:loader=testlogappwar
       <loader-repository-config>java2ParentDelegation=false
       </loader-repository-config>
       </loader-repository>
       </class-loading>
      


      4. added my own log4j.xml in WEB-INF directory for my application...
      Every thing else works fine but is not my application logs are not being generated ...

      The following exception is generated :
      
      13:26:43,234 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
      13:26:43,235 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
      13:26:43,235 ERROR [STDERR] log4j:ERROR [WebappClassLoader
       delegate: false
       repositories:
       /WEB-INF/classes/
      ----------> Parent Classloader:
      java.net.FactoryURLClassLoader@fe7f80
      ] whereas object of type
      13:26:43,236 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@c2a132].
      13:26:43,236 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE".



      Please help me out ...