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" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n" /> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" 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>
相关推荐
CXC0 2020-06-14
JavaWinner 2020-05-10
ljsfighting 2020-10-31
littleFatty 2020-08-16
katanaFlower 2020-06-21
caiyiii 2020-06-14
woxmh 2020-06-12
unit00 2020-06-07
ccjjyy 2020-05-21
Airuio 2020-05-19
福叔 2020-03-20
xinlugang 2020-03-07
陈晨软件五千言 2020-02-17
pushTop 2020-01-02
curiousL 2020-01-05
方志朋 2020-01-04