5 Replies Latest reply on Jun 5, 2012 8:56 AM by Vincent Mahe

    Log4j error when enabling the sift appender in the root logger

    Vincent Mahe Newbie

      Hello all

       

      I'm using apache-servicemix-4.4.1-fuse-01-13 under Window 2003 with Sun JDK 1.6.

       

      I wanted to test the sift Appender in the root logger by setting the following line in the org.ops4j.pax.logging.cfg configuration file :

          log4j.rootLogger=INFO, sift, osgi:VmLogAppender

       

       

      But when I restart Fuse with the servicemix.bin script, it shows the following error in the console :

      log4j:ERROR A "org.apache.log4j.FileAppender" object is not assignable to a "org.apache.log4j.spi.OptionHandler" variable.

      ...

       

      I am quite surprised because this sift appender is in the default pax logging configuration file.

      Is it related to my system configuration or JVM ?

       

      Thanks

       

      Regards,

       

      Vincent

        • 1. Re: Log4j error when enabling the sift appender in the root logger
          Freeman(Yue) Fang Master

          Hi,

           

          A quick question, besides the org.ops4j.pax.logging.cfg you changed, did you change any other default configuration? Or did you install any other log4j bundle yourself? Or you add any log4j jar on the classpath? What you mean by "Is it related to my system configuration or JVM"? Did you specify something special?

           

           

          Freeman

          • 2. Re: Log4j error when enabling the sift appender in the root logger
            Vincent Mahe Newbie

            Hello Freeman,

             

            In the pom.xml of my Camel bundles, I have the following dependencies :

             

             

            Therefore, I found in my MAVEN local repository a /log4j/ directory.

            I also have in this local repository a /commons-logging/ directory.

             

            I have commented the log4j dependency and moved the /log4j/ out of the Maven repository. I restarted FuseESB but still have the same error message

             

            Regarding my JVM, I did not configure anything special IMHO.

             

            Thanks for your help.

             

            Regards,

             

            Vincent

             

            Edited by: vmahe on Jun 5, 2012 6:40 AM

            • 3. Re: Log4j error when enabling the sift appender in the root logger
              Freeman(Yue) Fang Master

              Hi,

               

              What's the output when you use

              packages:exports |grep org.apache.log4j

              from the console?

               

              Freeman

              • 4. Re: Log4j error when enabling the sift appender in the root logger
                Vincent Mahe Newbie

                Here is what I have :

                 

                karaf@root> packages:exports | grep log4j

                     4 org.apache.log4j; version=1.2.15

                     4 org.apache.log4j.spi; version=1.2.15

                     4 org.apache.log4j.xml; version=1.2.15

                 

                Does that mean that there is some OSGI bundle exporting a different version of log4j ?

                 

                How can I know which bundle is exporting this ?

                 

                Thanks

                 

                Edited by: vmahe on Jun 5, 2012 7:07 AM

                • 5. Re: Log4j error when enabling the sift appender in the root logger
                  Vincent Mahe Newbie

                  Hello again,

                   

                  It seems that the Error message I have is related to the activemq-web-console logging.

                   

                  Because in the org.ops4j.pax.web.pax-web-extender-war.log file I have the following error :

                   

                  14:10:59,096 | INFO  | FelixStartLevel  | WebXmlObserver                   | Using as web application context name

                  14:10:59,096 | INFO  | FelixStartLevel  | WebXmlObserver                   | Using [] as web application root path

                  14:11:00,127 | ERROR | FelixStartLevel  | RegisterWebAppVisitorWC          | Registration exception. Skipping.

                  java.lang.NullPointerException

                  *     at org.apache.log4j.config.PaxPropertySetter.introspect(PaxPropertySetter.java:87)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.config.PaxPropertySetter.getPropertyDescriptor(PaxPropertySetter.java:359)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.config.PaxPropertySetter.setProperties(PaxPropertySetter.java:144)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.config.PaxPropertySetter.setProperties(PaxPropertySetter.java:108)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.config.PaxPropertySetter$ObjectFactory.create(PaxPropertySetter.java:234)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.sift.MDCSiftingAppender.getAppender(MDCSiftingAppender.java:109)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.sift.MDCSiftingAppender.append(MDCSiftingAppender.java:79)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                  *     at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)[3:org.ops4j.pax.logging.pax-logging-service:1.6.2]*

                   

                  Edited by: vmahe on Jun 5, 2012 12:55 PM