Spring JDBC is not logging SQL with log4j

后端 未结 6 1828
慢半拍i
慢半拍i 2020-12-11 20:06

I\'m researching spring for a possible switch to a spring stack. One of the things that I thought was cool was the ability for spring jdbc to log all the executed sql. So

6条回答
  •  执笔经年
    2020-12-11 21:04

    Try setting these additional log4j loggers. The first will spit out the SQL that passes through spring's JdbcTemplate, the second gives you parameter values that Spring sets on prepared statements.

    
      
    
    
    
      
    
    

    Clearly this is only going to work if you're directly or indirectly executing SQL using JdbcTemplate.

提交回复
热议问题