grails中的log4j:如何登录到文件? [英] log4j in grails : how to log into file?
问题描述
在我的grails config.groovy中有这个log4j配置
log4j = {
error'org.codehaus .groovy.grails.web.servlet',//控制器
'org.codehaus.groovy.grails.web.pages'// GSP
警告'org.mortbay.log'
$ b appenders {
rollingFile name:'infoLog',file:'info.log',threshold:org.apache.log4j.Level.INFO,maxFileSize:1024
rollingFile name: 'warnLog',文件:'warn.log',threshold:org.apache.log4j.Level.WARN,maxFileSize:1024
rollingFile name:'errorLog',file:'error.log',threshold:org。 apache.log4j.Level.ERROR,maxFileSize:1024
rollingFile name:'custom',file:'custom.log',maxFileSize:1024
}
root {
info'infoLog','warnLog','errorLog','custom',stdout
error()
additivity = true
}
}
<
现在我添加新的RollingFile机智名称custom...
现在我添加新的RollingFile机智名称custom...我尝试使用log.info(something .... $ {obj})从我的控制器和服务登录;
,但似乎消息没有被插入到custom.log中,我是否需要添加一些东西到配置?
谢谢!
刚刚从grails的邮件列表中得到了答案:
我只需要添加
调试grails.app
波纹管警告org.mortbay.log
案结案! :)
I have this log4j configuration in my grails config.groovy
log4j = {
error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.web.pages' // GSP
warn 'org.mortbay.log'
appenders {
rollingFile name:'infoLog', file:'info.log', threshold: org.apache.log4j.Level.INFO, maxFileSize:1024
rollingFile name:'warnLog', file:'warn.log', threshold: org.apache.log4j.Level.WARN, maxFileSize:1024
rollingFile name:'errorLog', file:'error.log', threshold: org.apache.log4j.Level.ERROR, maxFileSize:1024
rollingFile name:'custom', file:'custom.log', maxFileSize:1024
}
root {
info 'infoLog','warnLog','errorLog','custom', stdout
error()
additivity = true
}
}
the infoLog,warnLog and errorLog was from the previous question ... they were working well.
now I add new RollingFile wit name "custom" ...
I tried to log from my controller and service using log.info("something .... ${obj}"); but it seems that message was not inserted into custom.log, do I need to add something to the configuration ?
thank you !!
just got answer from the grails' mailing list:
i just need to add
debug "grails.app"
bellow warn "org.mortbay.log"
case closed ! :)
这篇关于grails中的log4j:如何登录到文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!