Grails - 从Quartz作业和过滤器记录

Ale*_*ier 2 grails logging file filter quartz-scheduler

我想将我的日志存入文件:这是我在Config.groovy中声明我的appender的方法:

log4j = {
    appenders {
    //    console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
        file name: "scraperServiceDetailedLogger",
             file: "target/scraperServiceDetailed.log"    
        file name: "scraperServiceLogger",
             file: "target/scraperService.log"             
        file name: "filterLogger",
             file: "target/filter.log"      
    }

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'
error scraperServiceDetailedLogger: "grails.app.service.personalcreditcomparator.ScraperService"
info scraperServiceLogger: "grails.app.jobs.personalcreditcomparator.ScraperJob"
info filterLogger: "grails.app.conf.personalcreditcomparator.AdministratorInterfaceProtectorFilters"

}
Run Code Online (Sandbox Code Playgroud)

3个文件已正确创建,但只能正确scraperServiceDetailedLogger存储日志.其他两个文件仍为空.

调用时会遵守日志记录级别log.

我错过了什么?

感谢您提供的任何帮助.

sch*_*159 6

对于quartz作业,请尝试使用'grails.app.task'的Logger前缀

info scraperServiceLogger: "grails.app.task.personalcreditcomparator.ScraperJob"
Run Code Online (Sandbox Code Playgroud)

对于过滤器,请尝试使用'grails.app.filters'的记录器前缀

info filterLogger: "grails.app.filters.personalcreditcomparator.AdministratorInterfaceProtectorFilters"
Run Code Online (Sandbox Code Playgroud)

  • 对于后代,它现在似乎是`grails.app.jobs ...` (2认同)