I am traying to get log4j to log to file in XMLLayout using the groovy log4j dsl. However, it seems that the "layout:"-part is being ignored. This is my setup:
appenders {
file name: 'fileAppender', layout: xml, file: '/tmp/logs/applog.xml', threshold: org.apache.log4j.Level.INFO
console name: "stdout", threshold: org.apache.log4j.Level.INFO
}
root {
debug 'stdout', 'fileAppender'
}
So to stdout I corectly get my info-level pattern layout, but in the file I also get pattern-layout...
What's the trick here?
This is a bug. I've fixed it for 2.0.1: http://jira.grails.org/browse/GRAILS-8635
The workaround as you found is to use the constructor explicitly instead of the DSL shortcut.