2012-07-13 65 views
1

對於什麼都原因,當我嘗試添加記錄 {...}塊到我的Grails log4j的配置,我收到以下錯誤:Grails的log4j配置log4j的配置錯誤時缺少方法:記錄

log4j:ERROR Method missing when configuring log4j: logger 

任何人都可以看到什麼可能是我的配置錯了嗎?這是一個Grails 1.3.3應用程序(即將升級到2)。

TIA,

約翰

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' 
    } 
} 

我也碰到下面的錯誤只是事先不知道它是否能扯上關係?

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. 
+0

你期待'logger'塊做什麼?這不是有效的配置選項。 – jamesallman 2012-07-13 03:57:59

+0

記錄器屬性出現在[Grails 1.0文檔](http://grails.org/doc/1.0/guide/3.%20Configuration.html)中的一個示例中,但似乎已經爲2.x刪除,但是我避難沒有發現任何跡象表明。 – 2012-07-13 13:05:45

回答

4

您在混淆語法 - 日誌配置在Grails 1.0和1.1之間完全更改。取而代之的

logger { 
    grails="error" 
} 

你只需要

error 'grails' 

沿着相同的模式,你越往上debug 'org.hibernate'