Ibatis执行SQL操作把SQL打印到控制台
要想让Ibatis打印SQL语句到控制台,可以在log4j.xml文件加入以下语句:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"><log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"><appender name="IBatis" /></layout><filter value="DEBUG" /><param name="LevelMax" value="DEBUG" /></filter></appender><logger name="com.ibatis" additivity="true"><level value="DEBUG"/></logger><logger name="java.sql.Connection" additivity="true"><level value="DEBUG" /></logger><logger name="java.sql.Statement" additivity="true"><level value="DEBUG" /></logger><logger name="java.sql.PreparedStatement" additivity="true"><level value="DEBUG" /><appender-ref ref="IBatis" /></logger><logger name="java.sql.ResultSet" additivity="true"><level value="DEBUG" /><appender-ref ref="IBatis" /></logger></log4j:configuration>