3 Replies Latest reply on Jul 12, 2012 1:14 PM by jamezp

    log4j doesn't work in latest nightly

    sergiu_pienar

      I'm using JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes" and getting such errors :

       

      06:08:45,088 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of "all-ejbs.jar"

      06:08:46,010 ERROR [stderr] (MSC service thread 1-5) log4j:ERROR Could not create an Appender. Reported error follows.

      06:08:46,011 ERROR [stderr] (MSC service thread 1-5) java.lang.ClassCastException: org.apache.log4j.DailyRollingFileAppender cannot be cast to org.apache.log4j.Appender

      06:08:46,012 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:248)

      06:08:46,012 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)

      06:08:46,014 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)

      06:08:46,015 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)

      06:08:46,017 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:436)

      06:08:46,018 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:999)

      06:08:46,019 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:867)

      06:08:46,021 ERROR [stderr] (MSC service thread 1-5)    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:794)

      06:08:46,022 ERROR [stderr] (MSC service thread 1-5)    at org.jboss.as.logging.LoggingConfigurationProcessor.deploy(LoggingConfigurationProcessor.java:111)

      06:08:46,024 ERROR [stderr] (MSC service thread 1-5)    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116)

      06:08:46,027 ERROR [stderr] (MSC service thread 1-5)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

      06:08:46,028 ERROR [stderr] (MSC service thread 1-5)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

      06:08:46,030 ERROR [stderr] (MSC service thread 1-5)    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      06:08:46,031 ERROR [stderr] (MSC service thread 1-5)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      06:08:46,033 ERROR [stderr] (MSC service thread 1-5)    at java.lang.Thread.run(Thread.java:662)

       

      My custom log4j.xml is attached. The log4j.xml is packed within a jar that is deployed inside the lib folder of an EAR.

       

      In the jboss-deployment-structure.xml I'm specifying such exclusions :

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>

       

      <deployment>

         

                <exclusions>

                          <module name="org.apache.log4j" />

                </exclusions>

       

      </deployment>

       

       

      <sub-deployment name="second.war">

                <exclusions>

                          <module name="org.apache.log4j" />

                </exclusions>

      </sub-deployment>

       

       

      <sub-deployment name="first.war">

                <exclusions>

                          <module name="org.apache.log4j" />

                </exclusions>

      </sub-deployment>

       

       

      <sub-deployment name="all-ejbs.jar">

                <exclusions>

                          <module name="org.apache.log4j" />

                </exclusions>

      </sub-deployment>

       

       

      </jboss-deployment-structure>

       

       

       

       

      Any ideas are welcome .

       

      Thank you

        • 1. Re: log4j doesn't work in latest nightly
          jamezp

          Not sure exactly, but in 7.2.x there is no need to exclude the servers log4j and include your own. There is a new deployment processor that will attempt to locate your log4j.xml and configure log4j for you.

           

          --

          James R. Perkins

          • 2. Re: log4j doesn't work in latest nightly
            sergiu_pienar

            I did try and remove the exclusions and nothing changed. In the mean-time I removed the log4j.jar that I had placed in the lib folder of the EAR and the log files were created as specified per log4j.xml but they did not get populated (the logging statements went to console instead .


            Not sure why this is happening since the log4j.xml used to work on JBoss 5.1.0 and JBoss 7.1.1 Final ....

             

            Thanks for the reply

            • 3. Re: log4j doesn't work in latest nightly
              jamezp

              Are you using log4j in your application?

               

              JBoss AS 7 does not use log4j as it's logging facade/manager. It uses JBoss Logging for the facade and JBoss Log Manager for the log manager.

               

              --

              James R. Perkins