Reputation: 8897
I have this logging configuration in my Config.groovy file. This is a development environment, started as such. I have verified the file exists and there are 775 perms on the file, but nothing is getting output to the file.
// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
development {
grails.serverURL = "http://localhost:8080/${appName}"
logFilePath = "/Users/davea/Tomcat/logs/log4j.log"
}
test {
grails.serverURL = "http://localhost:8080/${appName}"
}
}
// log4j configuration
log4j = {
console name:'Appender1',
layout:pattern(conversionPattern: '%-4r [%t] %-5p %c %x - %m%n')
rollingFile name:'Appender2', maxFileSize:1024 * 1024, file:logFilePath,
layout:pattern(conversionPattern: '%-4r [%t] %-5p %c %x - %m%n')
root {
debug 'Appender1', 'Appender2'
}
}
Can anyone tell what's wrong with my configuration? Thanks, - Dave
Upvotes: 1
Views: 1694
Reputation: 1673
have you tried to log on different log levels than DEBUG? here is an example with different logging settings for each environment.
log4j = {
appenders {
// for all environments
rollingFile name:"file", maxFileSize:(1024*1024), file:"logs\\logfile.log", maxBackupIndex:100
environments {
development {
console name:'stdout'
}
}
}
// default log level for some loggers
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'
warn 'org.mortbay.log'
environments {
development {
root {
debug 'file', 'stdout'
}
debug 'grails.app' // <--- maybe you forgot to define this logger for your app!
}//development
test {
root {
info 'file'
}
info 'grails.app'
}
production {
root {
error 'file'
}
error'grails.app'
}
}
}
Upvotes: 2