With Play 2.4.0 Anorm got moved to an external package and logging got changed to LogBack (http://logback.qos.ch)
All well and good but nowhere are the class/package names obvious for tracing SQL calls.
The "obvious" (based on the import statements)
<logger name="anorm" level="TRACE" />
did nothing and I also tried
<logger name="anorm.SQL" level="TRACE" />
just in case it needed to be more specific.
Google searches just dead needed so I'm at a loss.
Anyone?
Anorm doesn't log anything (and doesn't use logback), but 'output' is plain JDBC, so you can configure debug on your connection pool.
EDIT:
The debug utility from my framework Acolyte can be used to print/log the JDBC statement that would have been executed with the connection.
If you have
SQL"SELECT * FROM Test WHERE id = $id"
, you can debug it as following.You can intercept calls going thru JDBC driver using
I have used successfully with JPA/hibernate and Hikary on Play 2.4, the setup should be identically since this influences the JDBC layer.
Add the library to your build.sbt:
Adjust the config. Add log4jdbc, the log4jdbc automatically detects the underlying driver from the string: mysql. If you are using an obscure JDBC driver, you can configure it using config options - see docs below.
Example of my logback.xml, relevant part:
And, finally the log4jdbc.log4j2.properties (create it in the conf directory which is on the class path):
More docs: https://code.google.com/p/log4jdbc-log4j2/
Let me know if this works for you