我的 grails config.groovy 中有这个 log4j 配置
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
}
}
infoLog、warnLog 和 errorLog 来自上一个问题......它们运行良好。
现在我添加名为“custom”的新 RollingFile ...
我尝试使用 log.info("something .... ${obj}"); 从我的控制器和服务进行日志记录
但似乎消息没有插入到 custom.log 中,我需要在配置中添加一些内容吗?
谢谢 !!