Grails 1.1.1 log4j DSL throws MissingMethodException for PatternLayout configuration

I upgraded the Grails 1.0.3 application to Grails 1.1.1. I updated log4j configuration in Config.groovy to match the new DSL . However, after defining ConsoleAppender with PatternLayout, the application will not start and instead throws a MissingMethodException message 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 read the above message on several lines for readability).

My configuration:

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 tried changing the template by adding parentheses for the console () function, but without success. What causes this exception?

+3
source share
1 answer

, . :

log4j {
  ...
}

log4j = {
  ...
}

, , , / DSL, , .

+6

Source: https://habr.com/ru/post/1724538/


All Articles