[logback-user] Custom variables and AsyncAppender in logback.groovy
Marvin B. Lillehaug
marvin.lillehaug at gmail.com
Sat Jun 22 13:15:31 CEST 2013
On Sat, 22 Jun 2013 12:38:40 +0200, Marvin B. Lillehaug
<marvin.lillehaug at gmail.com> wrote:
> Hi,
> I'm trying to convert my xml configuration to groovy, and are having
> some problems.
> 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}
> (GafferConfigurator.run(..)).
>
> The way I am configuring with groovy is:
> ContextInitializer contextInitializer = new
> ContextInitializer(loggerContext);
> contextInitializer.configureByResource(configFile);
>
>
> Is there som other way I should do this, or do I have to do some magic
> to get my variable?
>
I found out that the magic I had to perform was «def loggingDirectory =
context.getProperty('logdir')»
--
Mvh,
Marvin B. Lillehaug
More information about the Logback-user
mailing list