[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">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level
[%.45(%thread)][%.32(%logger{32})] %msg%n</pattern>
</encoder>
</appender>
<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>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level
[%.45(%thread)][%.32(%logger{32})] %msg%n</pattern>
</encoder>
</appender>
<!-- ALL: INFO level -->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
<!-- Third-party: some reduced levels -->
<logger name="org.hibernate" level="TRACE" additivity="false">
<appender-ref ref="FILE"/>
</logger>
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?
Thanks,
Amit
-------------- 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