How do I configure logging for a grails plugin?

前端 未结 1 583
盖世英雄少女心
盖世英雄少女心 2020-12-20 15:16

I\'m creating my first grails plugin and I don\'t know where the logging should be configured.
In a normal grails app, there is a conf/Config.groovy file for that, but f

相关标签:
1条回答
  • 2020-12-20 15:54

    The create-plugin script doesn't create a Config.groovy but if you create one yourself it will be used. Don't copy one from an existing app since it'll be cluttered with stuff that isn't applicable, just create a log4j closure and whatever other properties you need:

    log4j = {
        error  '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'
    
        warn   'org.mortbay.log'
    }
    
    myplugin.someproperty = 'foo'
    
    0 讨论(0)
提交回复
热议问题