[logback-user] Custom variables and AsyncAppender in logback.groovy

Marvin B. Lillehaug marvin.lillehaug at gmail.com
Sat Jun 22 12:38:40 CEST 2013

I'm trying to convert my xml configuration to groovy, and are having some  
When using xml I defined a variable ${logdir} where the logs should end up.
In the xml config I just added logdir as a property in the LoggerContext,  
and reconfigured the context. and it worked.

However it seems that these properties are not made available to the  
config script. The only variable made available is ${hostname}  

The way I am configuring with groovy is:
ContextInitializer contextInitializer = new  

Is there som other way I should do this, or do I have to do some magic to  
get my variable?

I also use AsyncAppender. In xml these are defined by referencing an  
existing appender with appender-ref="nameofexistingappender", but it seems  
this does not work when using groovy.
Using appender-ref("nameofexistingappender"),  
AsyncAppender.addAppender(..) is called, but the argument is null.
Using http://jira.qos.ch/browse/LOGBACK-269 does work, but after all it is  
a hack.

Marvin B. Lillehaug

More information about the Logback-user mailing list