[logback-user] Setting log LEVEL on a per <appender-ref/> basis

Shane Kelly logback at ballinascreen.com
Sun May 6 14:59:15 CEST 2012


Ceki,

That would certainly explain why I couldn't find any detailed info :) The
RoutingAppender concept that you describe is quite interesting though - it
would certainly address our particular needs. In the short term I think
we'll have to go with existing logback configuration and capabilities
(which meet the vast majority of our logging requirements) and investigate
some sort of RoutingAppender solution in the medium to long term.

In the meantime, thanks for your help. Much appreciated.

Regards,

Shane

On 6 May 2012 11:53, ceki <ceki at qos.ch> wrote:

> Hi Shane,
> You could not have possibly be aware of RoutingAppender because it does
> not exist yet. For the moment, it's just an idea for solving the problem
> you described in your message. Browsing through logback documentation and
> source code should give you ideas about writing a RoutingAppender. Of
> course, once you get started you can ask for feedback here.
>
>
> Cheers,
> --
> Ceki
> http://twitter.com/#!/ceki
>
> On 05.05.2012 23:35, Shane Kelly wrote:
>
>> Hi Ceki,
>>
>> Thanks for your prompt response. I wasn't aware of routing appenders -
>> so this is something that I shall certainly look into. My main
>> motivation for wanting to do this was primarily so that I could control
>> the verboseness of logging for the same logger depending on the
>> destination appender without having to create several (almost duplicate)
>> appender configurations (whilst setting slightly different threshold
>> levels for each) - as far as possible I only wanted to create a single
>> appender configuration entry for each distinct destination - i.e.
>> Console, RollingFile etc. So, for example, I might have a logger in a
>> Java class which generates log messages of varying levels, but I only
>> want INFO and above to go to a Console appender, whilst I want DEBUG and
>> above to be written to a RollingFileAppender - for the same class -
>> simply because I don't want to clog up STDOUT with too much information
>> (unless I need to) but have a separate file to fall back to which does
>> contain a complete set of log messages for reference/debug at a later
>> date.
>>
>> Is there any documentation describing how to create routing appenders (I
>> had a quick look and couldn't see anything) or is there an example of
>> such an appender lurking somewhere within the source that you could
>> point me towards?
>>
>> Regards,
>>
>> Shane
>>
>>
> ______________________________**_________________
> 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/20120506/62016851/attachment.html>


More information about the Logback-user mailing list