5 Replies Latest reply on Dec 10, 2010 3:08 AM by jaikiran pai

    JBoss 6 logging

    mike just Master

      Is there a doc about how to configure log4j with my own application under JBoss 6.0.0.CR1 version?

        • 1. Re: JBoss 6 logging
          jaikiran pai Master

          Just package log4j jar and the log4j.xml file in your application.

          • 2. Re: JBoss 6 logging
            mike just Master

            Any detailed instruction? I tried but failed to work.

             

            I am deploying an ear under JBoss.

            • 3. Re: JBoss 6 logging
              jaikiran pai Master

              mike just wrote:

               

              Any detailed instruction? I tried but failed to work.

               

              How exactly did you package the jar and the config file? Is your application a .war or a .ear? Typically, you just have to place the log4j jar in the "lib" of your deployment and the log4j.xml in the folder which is available in the classpath (for example, .war/WEB-INF/classes).

              • 4. Re: JBoss 6 logging
                mike just Master

                I do not think you have tried and can confirm this. My project has been doing it like this but does not work under JBoss 6 now.

                 

                log4j in .ear\lib, log4j.xml in .war\WEB-INF\classes. log4j is copied from jboss common\lib directory.

                 

                ERROR [STDERR] (Thread-2) log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.

                • 5. Re: JBoss 6 logging
                  jaikiran pai Master

                  mike just wrote:

                   

                  I do not think you have tried and can confirm this.

                  No I have not tried that in AS6, because I never had the need to do so.

                   

                  mike just wrote:

                   

                  My project has been doing it like this but does not work under JBoss 6 now.

                   

                  log4j in .ear\lib, log4j.xml in .war\WEB-INF\classes. log4j is copied from jboss common\lib directory.

                   

                  ERROR [STDERR] (Thread-2) log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.

                  That's exactly the reason why you should provide the entire details on what doesn't work and not leave it to others to guess what might be wrong. In this sepecific case you are running into a classloader issue. You'll have to configure classloader for your application as explained in the "Isolation with Overriding Server Classes" section here http://community.jboss.org/wiki/classloadingconfiguration