[logback-user] How to log FROM an appender?

TJ Rothwell tj.rothwell at gmail.com
Wed Nov 16 18:48:48 CET 2011


The default OnConsoleStatusListener doesn't have filtering, however you
could create your own StatusListener that does, so that it only
outputs/logs the ones coming from your appender.

-- TJ

On Wed, Nov 16, 2011 at 11:45 AM, Steve Cohen <scohen at javactivity.org>wrote:

> On 11/16/2011 10:27 AM, Steve Cohen wrote:
>
>> On 11/16/2011 12:53 AM, Ceki Gulcu wrote:
>>
>>> Hi Steve,
>>>
>>> Logback components, including appenders, should use the status
>>> manager. If you look at logback code you should see invocations of
>>> addInfo, addWarn or addError methods strewn throughout the code.
>>>
>>> --
>>> Ceki
>>>
>>> On 12.11.2011 23:14, Steve Cohen wrote:
>>>
>>>> We have a custom appender that may itself need to issue logging
>>>> statements. But placing a logger in such a class causes various
>>>> exceptions on initialization and loading. So we are resorting to
>>>> System.out.println for lack of a better solution.
>>>>
>>>> I suppose there must be a better way.
>>>> What would that be?
>>>>
>>>
>>>
>>>
>>> ______________________________**_________________
>>> Logback-user mailing list
>>> Logback-user at qos.ch
>>> http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>>
>>>
>>>
>> Thanks, Ceki. I am looking into this. I have a question, though. If you,
>> for example, call addInfo() from an appender, which Logger decides
>> whether or not to log it? The root logger?
>> ______________________________**_________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>
>>
>>
> Looking at this a little more deeply, I see that this works, in the case
> of the OnConsoleStatusListener, via simply writing on the console.  But it
> seems that the level you choose to add (addInfo() vs addWarn() for example)
> affects only the status reported on the output device and there is no
> filtering available based on these "levels".  Is this correct?
>
>
>
> ______________________________**_________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20111116/32bb4909/attachment-0001.html>


More information about the Logback-user mailing list