Grails Melody plugin no longer logs SQL queries from grails 2.0

Since I upgraded my two grails projects to grails 2.0, the grails tune has stopped logging sql calls. I tried different versions of the grails-melody plugin, but I get the same error in all versions (even the version that worked before switching to grails 2.0).

I can not find anything useful for Google. If I add trace debugging on the grails ringtone plugin

log4j = { trace 'net.bull.javamelody' } 

I see this in the logs:

 DEBUG bull.javamelody - datasources found in JNDI: [] 

This problem really drives me crazy .. Has anyone here experienced this problem? And if you could find a solution?

UPDATE: Grails tune doesn’t even work on newly created projects. I just created a new grails project (grails 2.0.0) with one domain class and corresponding controller and views. Then install the grails-melody plugin. Insert some data. When I looked into the monitoring console, sql data is not logged.

GraphTables

+6
source share
2 answers

A partial workaround is to set jdbc.factory_class in the hibernation section of DataSource.groovy . For instance:

 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 SQL queries that go through sleep mode. Queries that use the data source are still not logged.

+4
source

I raised ataylor's answer as it made me start fixing the problem. But I still can not comment, so I will post it here.

The JDBC section of JavaMelody: JDBC docs describes how to do this using direct sleep mode using the driver’s own facade. I would suggest that this would work, except that for my life I cannot figure out the parameters to put in DataSource.groovy to make it work.

Link:

  <property name="hibernate.connection.driver_class">net.bull.javamelody.JdbcDriver</property> <property name="hibernate.connection.driver">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/myschema</property> <property name="hibernate.connection.username">myuser</property> <property name="hibernate.connection.password">mypassword</property> 
0
source

Source: https://habr.com/ru/post/911337/


All Articles