0

it seems that my grails (2.1) log4j config isn't used properly and i can't find the problem. The log file is created but empty and the stdout doesn't follow my pattern.

log4j = {

    appenders {
        rollingFile name: "myFileAppender", file: "LogFile.log", maxFileSize: 1024, layout:pattern(conversionPattern: '%d (%t) [%24F:%-3L:%-5p]%x %m%n')
        console name: 'myStdoutAppender', layout:pattern(conversionPattern: '%d (%t) [%24F:%-3L:%-5p]%x %m%n')

    }

    warn   'org.codehaus.groovy.grails.web.servlet',        // controllers
           'org.codehaus.groovy.grails.web.pages',          // GSP
           'org.codehaus.groovy.grails.web.sitemesh',       // layouts
           'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
           'org.codehaus.groovy.grails.web.mapping',        // URL mapping
           'org.codehaus.groovy.grails.commons',            // core / classloading
           'org.codehaus.groovy.grails.plugins',            // plugins
           'org.codehaus.groovy.grails.orm.hibernate',      // hibernate integration
           'org.springframework',
           'org.hibernate',
           'net.sf.ehcache.hibernate'    

   debug  'org.my.stuff',
          'grails.test',
          'grails.app'

   root = {
            debug 'myFileAppender', 'myStdoutAppender'
            additivity = true
    }
}

Anyone an idea what i did wrong?

4

1 回答 1

1

不要分配给根记录器。只需使用提供的闭包调用它:

// No equals sign
root {
    debug 'myFileAppender', 'myStdoutAppender'
    additivity = true
}
于 2012-08-30T21:45:33.850 回答