If I'm reading the code of the Grails Log4J DSL parser correctly you should just be able to say
root {
"${config.config.log.root.level}" 'stdout', 'file'
}
or if that doesn't work then
root {
delegate."${config.config.log.root.level}" 'stdout', 'file'
}
Normally, within the log4j
closure you have access to the complete grailsApplication.config
(including options merged in from external configuration files) as the variable config
but it looks like you need a second config
in front of that when you're inside the root {}
block.
Explanation - the closure delegate of the root
closure is a RootLog4jConfig
object, which has a property config
pointing to the main Log4jConfig
which is the delegate for the rest of the log4j
closure, and that in turn has its own property config
pointing to the parsed ConfigObject
. I somehow doubt that this behaviour is deliberate, and it might be worth a JIRA to suggest that config
should resolve to the same thing inside the root
block as outside it.