[logback-user] decorating an Appender with additional behavior ?

Andreas Andreakis andreas at refinedlabs.com
Tue Feb 22 14:21:06 CET 2011

Hello Ceki,

thanks for your response. 

Is it possible to configure an Appender in XML, if it decorates another ? Such that both appenders are configured declaratively. (I'm thinking of a Spring beans like config, where one bean references another) This would be especilly attractive in order to provide a "generic" Decorator.

A related question: In the case of XML configs, can one define how the specified properties (sub-elements) are mapped to a class ?
As far as I can judge, it seems like the XML config assumes POJO classes, where the properties map directly to POJO fields. 

kind regards,

-----Original Message-----
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of Ceki Gülcü
Sent: Dienstag, 22. Februar 2011 14:04
To: logback users list
Subject: Re: [logback-user] decorating an Appender with additional behavior ?

Hello Andreas,

It really depends in the additional behaviour you have in mind. It is possible to add filters to an appender. An appender can also wrap another appender to "decorate" it with additional behavior.

Note that the cyclic buffer is an intrinsic feature of SMTPAppender. I don't think you could transpose cyclic buffering to other appenders. You could bu the result would not necessarily make sense.


On 16/02/2011 11:49 AM, Andreas Andreakis wrote:
> Hello,
> which is the preferred way to decorate an Appender with additional 
> behavior ?
> Optimally, the new behavior should be applicable to any Appender.
> As an example consider the Cyclic Queue behavior of the SMPTAppender. 
> A CyclicQueueAppender could implement this feature and delegate calls 
> to a referenced concrete Appender, such that the feature can be 
> utilized in other (non-SMTP) scenarios as well.
> Also (if currently possible) the Decorator should be configured 
> declaratively within a configuration file.
> kind regards,
> Andreas
Logback-user mailing list
Logback-user at qos.ch

More information about the Logback-user mailing list