Possible Duplicate:
Seeing the underlying SQL in the Spring JdbcTemplate?
I am using jdbctemplate like this:
getJdbcTemplate.update("update ....... values (?,?,?....?)", myObject.getProperty1(), ...);
Is it possible for me to write out a logger.trace of the resulting sql sent to mysql?
It would make my debug process easier as I could see exactly what mysql is getting.
In your jdbc url, you can dynamically add the following property to enable mysql statement logging:
jdbc:mysql://localhost:3306/sakila?profileSQL=true
You can read more about this here:
http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html
Read up on the properties in the Debugging/Profiling section as a combination of these can be very flexible for log levels, log output etc. (eg. logger)
Another approach is to use a jdbc logging proxy library such as http://code.google.com/p/log4jdbc/