Ever since I upgraded my two grails projects to grails 2.0 grails-melody stopped logging sql calls. I've tried different versions of the grails-melody plugin, but I get the same error across all versions (even the version that worked before migrating to grails 2.0).
I can't seem to find anything useful googling. If I add a trace debug on the grails melody plugin
log4j = {
trace 'net.bull.javamelody'
}
I see this in the logs:
DEBUG bull.javamelody - datasources found in JNDI: []
This problem is really driving me crazy.. Has anyone here experienced this problem? And if so did you find a solution?
UPDATE: Grails melody doesn't even work in newly created projects. I just created a new grails project (grails 2.0.0) with one domain class and corresponding controller and views. Then installed the grails-melody plugin. Inserted some data. When I looked into the monitoring console, no sql data is being logged..
A partial workaround is to set jdbc.factory_class
in the hibernate section of DataSource.groovy
. For example:
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
jdbc.factory_class = 'net.bull.javamelody.HibernateBatcherFactory'
}
This will log all the SQL queries that go through hibernate. Queries that use the datasource directly still don't get logged.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With