该帖子尚未被邮件列表接受。大家好,
预先感谢您提供的任何帮助。我在尝试将日志跟踪到文件时遇到问题,并且不明白我使用的语法有什么问题。这是我登录 Config.groovy 的设置:
[SNIP]
log4j = {
// Example of changing the log pattern for the default console
// appender:
appenders {
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
file name: "scraperServiceLogger",
file: "target/scraperService.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'
'grails.app.'
error scraperServiceLogger: "grails.app.service.ScraperService"
warn 'org.mortbay.log'
debug 'grails.test.*'
}
[/SNIP]
以下是我尝试在我的 ScraperService.groovy 中使用它的方式:
[SNIP]
log.error "test"
[/SNIP]
我要写入的文件已正确创建,但登录仅显示在控制台上。非常感谢任何帮助:)
祝一切顺利。