I'm having a problem where logging works correctly when I run tomcat in non-forked mode from grails, but does not work correctly in forked mode.
Here is my Log4j configuration:
Config.groovy:
// log4j configuration
log4j = {
appenders {
file name:"fileLogger", file: "c:/logs/app-log.log", threshold: Level.DEBUG
}
debug fileLogger: ['com.foo', 'BootStrap']
info fileLogger: ['org.springframework']
error fileLogger: [
'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.hibernate',
'net.sf.ehcache.hibernate']
}
When I run grails run-app
, the log file is correcly populated.
However, when I change my BuildConfig.groovy
file to run tomcat in forked mode:
BuildConfig.groovy:
grails.project.fork = [
run: [maxMemory:1024, minMemory:64, debug:false, maxPerm:256]
]
The log file does not get populated.
Is there something wrong with my configuration? Why would it work in one mode, but not the other?