I’m pretty familiar with grails however my sql logging seems to always be on in production (tomcat6). It works as expected in development where I can toggle it on and off. I’ve disabled all logging in my datasource.groovy…
dataSource {
...
driverClassName = 'com.mysql.jdbc.Driver'
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
logSql = false //<-- still logs sql in production
properties {
...
}
}
environments {
production {
dataSource {
logSql = false //<-- still logs sql in production
}
}
}
and log4j in my config.groovy is pretty simple…
log4j = {
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'
}
Finally, I’m building my project using the ‘war’ command. Does anyone know where else this could be getting set?
I seem to remember having this problem when I first went live with a production war. I removed the logSql = false from the datasource section and just had it in each environment as needed. In fact I never put logSql = false – I either remove it completely or comment it out. I only have logSql = true when needed.
Not sure if that was the root cause or something else, but it fixed it and I haven’t had a problem since.