Since the official support is dropped in version 1.0.12, this project extends Logback Gaffer so that SiftingAppender
can be configured in Groovy DSL, e.g.:
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"])
- Build or download the jar for this project.
- Put it where you put
logback-classic-$VERSION.jar
. - Done!