Skip to content

Instantly share code, notes, and snippets.

@finnjohnsen
Created August 3, 2016 21:50
Show Gist options
  • Save finnjohnsen/87b14223aba07cf5f7c3c84c4f474e0f to your computer and use it in GitHub Desktop.
Save finnjohnsen/87b14223aba07cf5f7c3c84c4f474e0f to your computer and use it in GitHub Desktop.
import ch.qos.logback.classic.boolex.GEventEvaluator
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.ConsoleAppender
import ch.qos.logback.core.filter.EvaluatorFilter
import static ch.qos.logback.classic.Level.DEBUG
import static ch.qos.logback.core.spi.FilterReply.DENY
import static ch.qos.logback.core.spi.FilterReply.NEUTRAL
appender("CONSOLE", ConsoleAppender) {
encoder(PatternLayoutEncoder) {
pattern = "[%thread] %-5level %logger{15} - %msg %n" }
filter(EvaluatorFilter) {
evaluator(GEventEvaluator) {
expression = "!(e.getLoggerName().contains('com.finnjohnsen'))" }
onMismatch = DENY onMatch = NEUTRAL }
}
appender("COLOR_CONSOLE", ConsoleAppender) {
withJansi = true encoder(PatternLayoutEncoder) {
pattern = "[%thread] %highlight(%-5level) %boldWhite(%logger{15}) - %boldYellow(%msg) %n" }
}
root(DEBUG, ["CONSOLE"])
logger("com.finnjohnsen", DEBUG, ["COLOR_CONSOLE"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment