Spring Boot JDBC Template SQL Log
Try
log4j.category.org.springframework.jdbc.core = TRACE
The above statement will print SQL queries with inbound parameters as well.
Incase you need to log only the query use the following
log4j.category.org.springframework.jdbc.core = DEBUG
You can enable in your logback file with the following
<logger name="org.springframework.jdbc.core.JdbcTemplate">
<level value="debug" />
</logger>
<logger name="org.springframework.jdbc.core.StatementCreatorUtils">
<level value="debug" />
</logger>
Update : For Springboot 2.x , it would be
logging.level.org.springframework.jdbc.core=TRACE
Thanks zhuguowei!
Adding the following to your properties file also works:
logging.level.org.springframework.jdbc.core = TRACE