[logback-user] Extending Logback Gaffer to allow SiftingAppender to be configured when using Groovy DSL

yihtserns sim_yihtsern at yahoo.com
Sat Dec 5 15:01:10 UTC 2015


Hi.

So, I made a little project to extend Logback Gaffer so that SiftingAppender
can be configured in Groovy DSL, like this:

```
import ch.qos.logback.classic.sift.SiftingAppender
import ch.qos.logback.classic.sift.MDCBasedDiscriminator
import ch.qos.logback.classic.PatternLayout

appender("SIFT", SiftingAppender) {
  discriminator(MDCBasedDiscriminator) {
    key = "userid"
    defaultValue = "unknown"
  }
  sift {
    appender("FILE-${userid}", FileAppender) {
      file = "${userid}.log"
      append = false
      layout(PatternLayout) {
        pattern = "%d [%thread] %level %mdc %logger{35} - %msg%n"
      }
    }
  }
}

root(DEBUG, ["SIFT"])
```

The codebase still needs a little bit of polish, but functionality wise, it
should work OK.

To try it out, go to https://github.com/yihtserns/logback-gaffer-sift.  Hope
you'll like it.  :) 



--
View this message in context: http://logback.10977.n7.nabble.com/Extending-Logback-Gaffer-to-allow-SiftingAppender-to-be-configured-when-using-Groovy-DSL-tp14461.html
Sent from the Users mailing list archive at Nabble.com.


More information about the logback-user mailing list