[logback-user] Different Log Levels For Different Appenders?

Eric Faden eric at techeminence.com
Wed Aug 27 23:01:09 CEST 2008


So suppose I set my root logger to error, but I want to have another 
logger operate at debug level.  When I do that it makes that loggers 
level debug for all appenders.  For example take the following

<configuration>

  <appender name="*FILE*"
     ....
  </appender>

  <appender name="*STDOUT*"
     ...
  </appender>

  <logger name="mylogger">
    <level value="debug" />
**    <appender-ref ref="FILE" />**
  </logger>

  <root>
    <level value="error" />*
    <appender-ref ref="STDOUT" />*
  </root>
</configuration>


In this example mylogger would output at debug level to BOTH STDOUT and FILE.  Is it possible to only get mylogger to output at debug level to FILE and error to STDOUT?  I realize that I can add a filter to the STDOUT appender to filter anything below ERROR, but I was curious if there was another way to do this, possibly cleaner?

-Eric




More information about the Logback-user mailing list