Help

Controls

PermLinkWikiLink
Switch Workspace

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
14. Feb 2008, 03:14 America/New_York | Link

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>

3 Replies:
14. Feb 2008, 08:03 America/New_York | Link

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"/>
Rating:  * * *
14. Feb 2008, 08:34 America/New_York | Link

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.

14. Feb 2008, 15:30 America/New_York | Link

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..

Rating:  * * * * *