Aly Martin
Aly Martin

Reputation: 113

Grails log4j configuration - ERROR Method missing when configuring log4j: logger

For what ever reason when I attempt to add a logger {...} block to my Grails log4j configuration, I receive the following error:

log4j:ERROR Method missing when configuring log4j: logger

Can anyone see what might be wrong with my configuration? This is a Grails 1.3.3 application (soon to be upgraded to 2).

TIA,

John

log4j = {
   error 'org.codehaus.groovy.grails.web.servlet',  //  controllers
         'org.codehaus.groovy.grails.web.pages', //  GSP
         'net.sf.ehcache.hibernate'
   debug 'org.hibernate'

   appenders {
       console name:'stdout', layout:pattern(conversionPattern: '[%t] %-5p %c{2} %x - %m%n')
   }

   logger {
      grails="error"
   }

   root {
      info 'stdout'
   }
} 

I also get the following error just beforehand and don't know if it could be related?

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/pbwebguy/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data/dev/src/tdstm-trunk/./plugins/jmesa-0.8/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

Upvotes: 1

Views: 3410

Answers (1)

Ian Roberts
Ian Roberts

Reputation: 122364

You're mixing up your syntaxes - logging configuration changed completely between Grails 1.0 and 1.1. Instead of

logger {
  grails="error"
} 

you just need

error 'grails'

along the same pattern as the debug 'org.hibernate' you have higher up.

Upvotes: 4

Related Questions