If you need to see the SQL executed by Spring jdbc classes, you can use log4j configuration to turn on debug logging level on the org.springframework.jdbc.core package
log4j.category.org.springframework.jdbc.core=DEBUG
This will leave in your log files very useful pieces of information:
- the SQL
- the values set for each query parameter
- the number of rows affected
DEBUG core.JdbcTemplate - Executing SQL update [INSERT INTO analysisResult (ANALYZABLEID, ASIGNEEID, STARTDATE, ENDDATE, CODE, LIMIT, NUMINCIDENCES, NUMLIVEINCIDENCES, NUMLIVEINCIDENCESDAY, NUMLIVEINCIDENCESDAYANYONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
DEBUG core.StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [5], value class [java.lang.Long], SQL type -5
DEBUG core.JdbcTemplate - SQL update affected 1 rows
Hopefully, this will save you some minutes someday.



Friday, August 15, 2008 at 07:31
Thanks. This is exactly what I needed.
Monday, November 24, 2008 at 20:24
What does category stand for ?
Can you give a more generic template??
Monday, November 24, 2008 at 22:00
“category” has been replaced by “logger” in recent log4j releases.
Thursday, June 18, 2009 at 14:51
Cool, thanks