6 Replies Latest reply on Nov 11, 2002 9:18 AM by crobert

    log4j from within a bean hangs jboss

    crobert



      Hello,

      I have a problem when using log4j from within a stateless session bean: from time to time, unpredictable almost, jboss hangs!

      In the session bean I have the following code:

      private static final Logger log = Logger.getLogger(MySampleBean.class);

      and then further down in a bean's method:

      if (log.isDebugEnabled()) {
      log.debug("MySampleBean: debug");
      }

      However, when calling the remote method of the bean (the one with the log4j debug call) jboss hangs!! JNDI lookup works from the client, but no calls to the bean's methods are executed!!

      That's very strange. We are not allowed to use log4j from within a bean ? What is the explanation ? Is there a workaround ?

      Thanks,
      Robert

      I'm using jboss 3.0.0 final, jdk 1.3.0, Windows NT.

        • 1. Re: log4j from within a bean hangs jboss
          crobert


          With JBoss 3.0.1 and JDK 1.3.1, the problem is still there. Isn't any of you experiencing the same problem with log4j when being used from a stateless session bean, as above ?

          Robert

          • 2. Re: log4j from within a bean hangs jboss

            Turn off "quick edit mode" on your console.

            Right click on the window title bar and select
            properties.

            Regards,
            Adrian

            • 3. Re: log4j from within a bean hangs jboss
              crobert


              Ummm.. It's already turned off! (I had such a problem before, with the "quick edit edit mode": I had to press a key on the server's console, for the remote call to execute -- problem with the log4j Console Appender I guess -- and that's when I turned off the quick edit mode)
              So right now, when it hangs, it's _frozen_ .. I have to kill the java process in order to terminate the execution. Very strange. Anyway, thanks for the suggestion.

              Robert

              • 4. Re: log4j from within a bean hangs jboss
                sdixit

                Did you find any solution to this problem?

                Sandeep

                • 5. Re: log4j from within a bean hangs jboss
                  crobert


                  Unfortunately no. :-/ I stopped using log4j and implemented a lightweight logger with no threads inside and my problem dissapeared. (I haven't tested the problem with Jboss 3.0.2 or 3.0.3 though)

                  Were you able to reproduce it too ?

                  Robert

                  • 6. Re: log4j from within a bean hangs jboss
                    crobert


                    Ok. According to the "Changes between JBoss-3.0.4 and JBoss-3.0.3", this appears to be fixed:

                    "module: src/main/org/jboss/logging/util; files: CategoryStream.java
                    comments: Remove the synchronized on write as it can cause deadlock if a thread is a log4j call at the same time another thread is issuing a System.out. Fixed bug #619171"