1 Reply Latest reply on Aug 21, 2002 3:49 PM by anoopsinghal

    Logger Call in Session Bean

    anoopsinghal

      Others have posted similar topics but did not get any reply. I hope that I get some.

      I have a session bean and I log a "DEBUG" message in the create method of the bean.

      If I set the priority to "DEBUG" in the CONSOLE Appender in log4j.xml, I see the message along with many others but if I set the priority to "info" in the Appender, I do not see any messages.

      Here is the XML cocnfiguration and code Snippet:






      <!-- The default pattern: Date Priority [Category] Message\n -->








      Java Code:

      com.mycompany.myBean
      {
      ejbCreate()
      {
      Logger logger = Logger.getLogger("com.mycompany");
      if (logger.isDebugEnabled()) {
      logger.debug("ejbCreate Called");
      }
      }
      }

      Note that I have turned on Debugging at higher (myCompany) level. I jave tried stating the Appending in the categoty statement as well as giving the full path of the bean in the name. Nothing works.

      Please help.

        • 1. Re: Logger Call in Session Bean
          anoopsinghal

          Thanks a lot to Mark who gave me the following insight.

          I believe you're problem is related to not understanding the logging PRIORITY or levels. There's a precedence with DEBUG being the lowest and FATAL being the highest. This is the reason that you are not seeing your output - you've told L4J to not output anything with a lower priority than INFO - which DEBUG is. You need to log messages as INFO or alternatively, keep your code the same and revert your priority to DEBUG.

          I had never played with setting priorities at Appender level before.