[logback-user] How to send one event to more than one appender using the SiftingAppender?

diroussel nabble at diroussel.xsmail.com
Fri Apr 19 15:10:29 CEST 2013


I can't see how that would work at the moment.

SiftingAppender keeps it's child appenders, and when a log events comes in
it will only log to one of them.

I suppose, if you can write a custom appender that gets a reference to the
SiftingAppender, then you can do this:

class FanOutAppender implements Appender {
  SiftingAppender sift;
  void doAppend(E event) {
    // Fan out log event to all child appenders of sift
    for (Appender a : sift.getAppenderTracker().valueList()) {

And that will log to all appenders.  The trick is using filters so your log
event goes to either the sifting appender or your custom FanOutAppender


View this message in context: http://logback.10977.n7.nabble.com/How-to-send-one-event-to-more-than-one-appender-using-the-SiftingAppender-tp12011p12029.html
Sent from the Users mailing list archive at Nabble.com.

More information about the Logback-user mailing list