[logback-user] configuring logback to log to two different
øyvind rotnes
rotnes at gmail.com
Mon May 12 15:22:37 CEST 2008
Hi. I am new to logback and have some problem with setting up the configuration.
I want to add some new functionality to the existing logging
configuration that was already in use in the application.
I want my application to write log events from the classes that are in
the package: "com.my.package" to a FILE
>From the documentation I undestod that this can be done with
<logger additivity="false" name="com.my.package">
<level value="debug" />
<appender-ref ref="FILE" />
</logger>
which points to a file appender. My logback.xml is listet below. This
configuration prints everything to the console, but nothing to the
FILE.
Can someone please point out for me where i am doing wrong?
Thanks!
<configuration debug="true">
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>c:\temp\testAction.log</File>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>testAction.%i.log.zip</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>3</MaxIndex>
</rollingPolicy>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>5MB</MaxFileSize>
</triggeringPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %X{action} %msg%n</Pattern>
</layout>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%msg%n</Pattern>
</layout>
</appender>
<logger additivity="false" name="com.my.package">
<level value="debug" />
<appender-ref ref="FILE" />
</logger>
<root>
<level value="debug" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
More information about the Logback-user
mailing list