I've upgraded a Grails 1.0.3 app to Grails 1.1.1. I've upgraded the log4j configuration in Config.groovy to conform to the new DSL . However, after defining a ConsoleAppender with a PatternLayout, the application won't start, and instead throws a MissingMethodException with the message:
groovy.lang.MissingMethodException: No signature of method: \
groovy.util.ConfigSlurper$_parse_closure5.pattern() is applicable \
for argument types: (java.util.LinkedHashMap) \
values: [[conversionPattern:%d{ISO8601} [%10.10t] [%18.18c] [%5p] - %m%n]]
(I broke the above message into multiple lines for readability).
My configuration is:
environments {
development {
log4j {
appenders {
console name: 'myAppender',
layout: pattern(conversionPattern: '%d{ISO8601} [%10.10t] [%18.18c] [%5p] - %m%n')
...
}
root {
error 'myAppender'
additivity = true
}
error 'org.codehaus.groovy.grails.plugins',
'org.codehaus.groovy.grails.orm.hibernate',
...
}
...
}
I've tried changing the pattern, adding parentheses for the console() function, but with no success. What's causing this Exception?
Turns out I had missed an equals sign in the configuration. The solution was to change:
log4j {
...
}
to
log4j = {
...
}
Pretty obvious solution once you see it as compared to the examples in the documentation, but when you're getting errors for specific closures/methods within the DSL, the errors don't make it obvious what the real issue is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.