Skip to content

Extends Logback Gaffer so that SiftingAppender can be configured in Groovy DSL.

License

Notifications You must be signed in to change notification settings

yihtserns/logback-gaffer-sift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logback Gaffer - Sift

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"])

Usage instruction

  1. Build or download the jar for this project.
  2. Put it where you put logback-classic-$VERSION.jar.
  3. Done!

About

Extends Logback Gaffer so that SiftingAppender can be configured in Groovy DSL.

Resources

License

Stars

Watchers

Forks

Packages

No packages published