[logback-user] Re : Re: Assigning a log level to an appender

Benoît Thiébault thiebault at artenum.com
Sat Dec 15 06:49:02 CET 2012


Great! 
Exactly what I was looking for.
Thanks

Ralph Goers <rgoers at apache.org> a écrit :

>
>See http://logback.qos.ch/manual/filters.html#levelFilter
>
>Ralph
>
>On Dec 14, 2012, at 6:40 AM, Benoît Thiébault wrote:
>
>> 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
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/logback-user
>
>
>_______________________________________________
>Logback-user mailing list
>Logback-user at qos.ch
>http://mailman.qos.ch/mailman/listinfo/logback-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20121215/f5c132d8/attachment.html>


More information about the Logback-user mailing list