[logback-user] How to log messages from different packages to different appenders with logback

amit shah amits.84 at gmail.com
Tue Jul 21 14:52:16 CEST 2015

I am trying to log messages from third party libraries to different file
with the below logback extract

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
            <pattern>%d{HH:mm:ss.SSS} %-5level
[%.45(%thread)][%.32(%logger{32})] %msg%n</pattern>

    <timestamp key="byDay" datePattern="yyyyMMdd'T'HHmmss"/>

    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <file>F:\v1\devel\logs\app-${byDay}.txt </file>
            <pattern>%d{HH:mm:ss.SSS} %-5level
[%.45(%thread)][%.32(%logger{32})] %msg%n</pattern>

    <!-- ALL: INFO level -->
    <root level="INFO">
        <appender-ref ref="CONSOLE"/>

    <!-- Third-party: some reduced levels -->
    <logger name="org.hibernate" level="TRACE" additivity="false">
        <appender-ref ref="FILE"/>

I want hibernate TRACE level logs to be logged to a file while other INFO
messages should go to the console. The above xml config isn't working for
me. Nothing gets logged to the file.

Any suggestions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150721/e432bcdb/attachment.html>

More information about the Logback-user mailing list