jdbcTemplate:包含占位符的SQL无法打印参数信息


网上的解决方案是在log4j设置以下参数:(如:http://my.oschina.net/wamdy/blog/468491)
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=debug
log4j.logger.org.springframework.jdbc.core.StatementCreatorUtils=debug 

但是设置后打印的内容只包含sql语句,不包含参数信息


经过多方寻找都是上文的解决方案,后来在此找到了结果:http://stackoverflow.com/questions/1932208/seeing-the-underlying-sql-in-the-spring-jdbctemplate
需要设置:log4j.logger.org.springframework.jdbc.core.StatementCreatorUtils=Trace
JdbcTemplate 还是设为debug
如下:
#输出SQL语句
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=debug
#输出参数值
log4j.logger.org.springframework.jdbc.core.StatementCreatorUtils=Trace

 






posted @ 2016-04-06 16:34    阅读(6276)  评论(1编辑  收藏  举报