2011-09-02 27 views
2

我想我的日誌股票進入文件: 這裏是我聲明我的appender Config.groovy中:Grails的 - 從石英工作記錄和過濾

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" 

} 

3個文件正確,但只有scraperServiceDetailedLogger創建正確存儲日誌。其他兩個文件保持空白。

在調用log時,記錄的級別得到了尊重。

我錯過了什麼?

謝謝你提供的任何幫助。

回答

6

石英工作嘗試「grails.app.task」的記錄儀前綴

info scraperServiceLogger: "grails.app.task.personalcreditcomparator.ScraperJob" 

而對於過濾器嘗試的「grails.app.filters」

info filterLogger: "grails.app.filters.personalcreditcomparator.AdministratorInterfaceProtectorFilters" 
+0

非常感謝你的記錄器前綴許多。它工作順利 –

+2

爲了後代,它現在似乎是'grails.app.jobs ...' –