控制台显示sql语句

在log4j.properties这个配置文件中加入以下配置语句即可:
log4j.logger.com.ibatis = DEBUG 
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource = DEBUG 
log4j.logger.com.ibatis.common.jdbc.ScriptRunner = DEBUG 
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate = DEBUG 
log4j.logger.java.sql.Connection = DEBUG 
log4j.logger.java.sql.Statement = DEBUG 
log4j.logger.java.sql.PreparedStatement = DEBUG, fileout 
log4j.logger.java.sql.ResultSet = DEBUG
==================================================
1.<appender name="IBatis" class="org.apache.log4j.ConsoleAppender"> 
2. 
3.<layout class="org.apache.log4j.PatternLayout"> 
4. 
5.<param name="ConversionPattern" 
6. 
7.value="%-4r [%t] %-5p %c %x - %m%n" /> 
8. 
9.</layout> 
10. 
11.<filter class="org.apache.log4j.varia.LevelRangeFilter"> 
12. 
13.<param name="LevelMin" value="DEBUG" /> 
14. 
15.<param name="LevelMax" value="DEBUG" /> 
16. 
17.</filter> 
18. 
19.</appender> 
20. 
21.<logger name="com.ibatis" additivity="true"> 
22. 
23.<level value="DEBUG" /> 
24. 
25.</logger> 
26. 
27.<logger name="java.sql.Connection" additivity="true"> 
28. 
29.<level value="DEBUG" /> 
30. 
31.</logger> 
32. 
33.<logger name="java.sql.Statement" additivity="true"> 
34. 
35.<level value="DEBUG" /> 
36. 
37.</logger> 
38. 
39.<logger name="java.sql.PreparedStatement" additivity="true"> 
40. 
41.<level value="DEBUG" /> 
42. 
43.<appender-ref ref="IBatis" /> 
44. 
45.</logger> 
46. 
47.<logger name="java.sql.ResultSet" additivity="true"> 
48. 
49.<level value="DEBUG" /> 
50. 
51.<appender-ref ref="IBatis" /> 
52. 
53.</logger>

你可能感兴趣的:(sql语句)