[logback-user] Assigning a log level to an appender
Benoît Thiébault
thiebault at artenum.com
Fri Dec 14 15:40:09 CET 2012
Hi everyone,
I have developed a custom LogBack appender and I would like it to receive only log messages of a given level. I don't want to hard code it in the class, but to set it in the XML configuration file.
I thought something like this would work (but it doesn't):
<root level="trace">
<appender-ref ref="FILE" />
<appender-ref ref="MyTraceAppender" />
<appender-ref ref="MyInfoAppender" level="info"/>
</root>
I also tried something like:
<appender name="MyTraceAppender" class="org.test.MyLogger1"/>
<appender name="MyInfoAppender" class="org.test.MyLogger2" level="info"/>
No luck either.
It seems only loggers can be assigned a threshold level. So I though about something like this:
<logger name="test" level="info">
<appender-ref ref="MyInfoAppender" />
</logger>
but this would only log messages sent by classes whose package is test. *... And I want to log anything.
Can anyone help?
Thanks
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20121214/e90fae12/attachment.html>
More information about the Logback-user
mailing list