Add a ContextListener in Groovy Config

Sorry if this has been asked before. I'm new to the user list, and I find it difficult to search the archives. How can I add a contextListener in a logback.groovy config file? On this page: http://logback.qos.ch/manual/configuration.html#contextListener It talks about adding a context listener specifically to deal with LevelChangePropogator. I'd like to do this, but I generally prefer the groovy syntax to the xml syntax. This page: http://logback.qos.ch/manual/groovy.html Talks a lot about the groovy syntax, but it doesn't specifically mention how to set up a contextListener. How can I do it? I have tried some things I thought would work, but they didn't. Groovy Version: 2.0.0 Logback Classic: 1.0.0 Thanks, Pepper

Took me a while, but it looks like this works: import ch.qos.logback.classic.encoder.PatternLayoutEncoder import ch.qos.logback.classic.jul.LevelChangePropagator import ch.qos.logback.core.ConsoleAppender import static ch.qos.logback.classic.Level.INFO context = new LevelChangePropagator() context.resetJUL = true appender("STDOUT", ConsoleAppender) { encoder(PatternLayoutEncoder) { pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" } } root(INFO, ["STDOUT"])
participants (1)
-
Pepper Lebeck-Jobe