3 Replies Latest reply on Feb 14, 2008 3:30 PM by norman

    Changing Seam Logger Category to DEBUG in JBoss

    waacow

      I'm new to Seam and trying to make good use out of it.  I'm struggling a bit sometimes to figure out how I used to be able to do things in the old way and then trying to do it the Seam way.


      For instance to configure a Logger. 


      Old Version


      package com.example.session;
      public class Example {
        private static final Log log = LogFactory.getLog(Example.class);
        public Example() {
          log.debug("init Example");
        } 
      }
      




      Seam Version


      package com.example.session;
      public class Example {
        @Logger private Log log;
        public Example() {
          log.debug("init Example");
        } 
      }
      



      Question:  Does 'log' in Seam version is the same as LogFactory.getLog(Example.class) which has a category name of com.example.session.Example.


      When running under JBoss (jboss-log4j.xml) seem to indicate the default log category will be INFO.


      I tried adding the following to jboss-log4j.xml and it still didn't output the debug statement in Example class.  Am I missing something here?


         <category name="com.example">
            <priority value="DEBUG"/>
         </category>
      




        • 1. Re: Changing Seam Logger Category to DEBUG in JBoss
          shane.bryzak

          You can set the logging threshold within the appender, like this:



             <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
                <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                <param name="Target" value="System.out"/>
                <param name="Threshold" value="DEBUG"/>


          • 2. Re: Changing Seam Logger Category to DEBUG in JBoss
            waacow

            I tried setting the logging threshold to 'DEBUG' but that really make the log very verbose and really all I'm interesting in during normal application development is the DEBUG output from our package 'com.example.*' and not DEBUG output from JBoss or Seam.

            • 3. Re: Changing Seam Logger Category to DEBUG in JBoss
              norman

              In general, this is just hard to do with log4j.  You need to go change the log levels of other things to INFO if you don't want their DEBUG.


              A simpler option would be to create a new seam.log file and set that as the appender-ref for your seam log messages.  Then your Seam messages (and only your seam messages) will go to the new log file exactly the way you want them to..