[logback-user] Multiple files and other issues
Ceki Gulcu
ceki at qos.ch
Fri Mar 6 13:35:05 CET 2009
See http://logback.qos.ch/manual/configuration.html#syntax
This configuration file below separates logs for "special.package.one"
<configuration debug="true">
<appender name="ROOT" class="ch.qos.logback.core.FileAppender" >
<file>myapp.log</file>
<append>false</append>
<layout>
<pattern>%d{yyyy-MM-dd HH:mm:ss},%p,%c,%F,%C{1} %m%n</pattern>
</layout>
</appender>
<appender name="PACKAGE1" class="ch.qos.logback.core.FileAppender" >
<file>specialone.log</file>
<append>false</append>
<layout>
<pattern>%d{yyyy-MM-dd HH:mm:ss},%p,%c,%F,%C{1} %m%n</pattern>
</layout>
</appender>
<logger name="special.package.one" additivity="false">
<appender-ref ref="PACKAGE1"/>
</logger>
<root level="DEBUG">
<appender-ref ref="ROOT"/>
</root>
</configuration>
HTH,
m.bresciani at email.it wrote:
> Thanks,
> I've given a very brief look and seems interesting and anyway useful.
>
> So, except for MDC, now I have to filter the packages. These go to
> different files, right?
>
> i.e.:
>
> whole application (or unspecified packages) - myapp.log
> special.package.one - specialone.log
> special.package.two - specialtwo.log
> sub-app or external load - anotherlog.log
>
> and so on.
>
> Thanks,
>
> Marco
>
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
More information about the Logback-user
mailing list