2 Replies Latest reply on May 5, 2010 4:08 AM by putypuruty

    Upgrade from 4.2.3 to 5.1 - log4j issue

    putypuruty

      Hi,

       

      We are trying to upgrade from JBOSS 4.2.3 to 5.1 but we are having problems with log4j. We have log4j.xml and log4j.jar bundled in each EAR. log4j.jar is in the lib folder and log4j.xml & log4j.dtd are in the EAR root. The log4j.xml file contains a Console and a custom RollingFileAppender appenders. The file appender is configured to output into ${jboss.server.home.dir}/logs/Filename.log. In each EAR we pack an EJB. This worked nicely in 4.2.3: the log file was being created and the logs generated by the EJB were written into the file. But this no longer works in JBOSS 5.1. The first time we invoke the EJB, we get the following in Eclipse's console and nothing is written into the log file (also, nothing appears anymore in Eclipse's console):

       

       

      [STDOUT] log4j: Trying to find [log4j.xml] using context classloader  BaseClassLoader@1a729c1{vfsfile:/E:/usr/jboss-5.1.0.GA/server/admin/deploy/ejb3-connectors-jboss-beans.xml}.
       20:17:01,373 INFO  [STDOUT] log4j: Trying to find [log4j.xml] using  BaseClassLoader@164ff8f{vfszip:/E:/usr/jboss-5.1.0.GA/server/admin/deploy/Admin.ear/}  class loader.
       20:17:01,374 INFO  [STDOUT] log4j: Using URL [vfszip:/E:/usr/jboss-5.1.0.GA/server/admin/deploy/Admin.ear/log4j.xml]  for automatic log4j configuration.
       20:17:01,375 INFO  [STDOUT] log4j: Preferred configurator class:  org.apache.log4j.xml.DOMConfigurator
      20:17:01,376 ERROR [STDERR]  log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not  assignable to a "org.apache.log4j.spi.Configurator" variable.
       20:17:01,376 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.spi.Configurator"  was loaded by 
      20:17:01,376 ERROR [STDERR] log4j:ERROR  [BaseClassLoader@164ff8f{vfszip:/E:/usr/jboss-5.1.0.GA/server/admin/deploy/Admin.ear/}]  whereas object of type 
       20:17:01,376 ERROR [STDERR] log4j:ERROR "org.apache.log4j.xml.DOMConfigurator"  was loaded by [BaseClassLoader@b81eaa{vfsfile:/E:/usr/jboss-5.1.0.GA/server/admin/conf/jboss-service.xml}].
       20:17:01,376 ERROR [STDERR] log4j:ERROR Could not instantiate  configurator [org.apache.log4j.xml.DOMConfigurator].
      20:17:01,626  WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use  InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry  should be used via the bean container
       20:17:01,629 WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use  InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry  should be used via the bean container
      20:17:01,647 ERROR [STDERR]  log4j:WARN No appenders could be found for logger  (osands.common.application.base.ApplicationImpl).
       20:17:01,647 ERROR [STDERR] log4j:WARN Please initialize the log4j  system properly.
      

       

       

      FYI, we are using the standard server.

       

      Can you give us a clue? Should this be working in JBOSS 5.1 or is it a bug?

       

      Thank you,

       

      Cosmin

        • 1. Re: Upgrade from 4.2.3 to 5.1 - log4j issue
          jaikiran

          This is the second thread in recent weeks about this issue. I haven't had time to try this out in AS 5.1. I know it used to work with AS-4.x. Let me give it a try locally (might take a couple of days) and see what the issue is. I'll update this thread once I figure out what's wrong. In the meantime if someone else finds out the problem, feel free to update this thread.

          • 2. Re: Upgrade from 4.2.3 to 5.1 - log4j issue
            putypuruty

            Just a follow up: if inside the EAR we package only a WAR and we access a servlet, logging works as expected:

             

            09:10:54,750 INFO  [STDOUT] log4j: Trying to find [log4j.xml] using  context classloader org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@13e7829.
            09:10:54,750  INFO  [STDOUT] log4j: Using URL [vfszip:/E:/usr/jboss-5.1.0.GA/server/admin/deploy/Admin.ear/log4j.xml
            ]  for automatic log4j configuration.