I am using Glassfish 4 and Hibernate 4.3.
How can I log every query from Hibernate?
My first try involved SLF4J 1.7.7 and Logback 1.1.2. I have tried some tutorials using SLF4J and Logback, but with no results. One tutorial said to change some files manually and add some options to glassfish, but I dislike this way.
In my second try I have used P6SPY 2.0.2. To make this library work I need to change my connection to use P6SPY drivers and configure spy.properties to use the real driver. Since I have configured my connection pool on Glassfish, I tried the P6SPY installation tutorial to configure it there, but I haven't managed to make my new DataSource to work. In P6SPY installation tutorial, there's a way to configure using java.sqlDriver and javax.sql.ConnectionPoolDataSource, but I am using javax.sql.DataSource.
So, is this the only way to use SLF4J with Glassfish? Do you know a tutorial or how to configure it?
If SLF4J won't work, how can I configure P6SPY to log my queries using the Glassfish connection pool?
Are there a better option?
Thanks in advance.