ibatis配置log4j输出sql语句等日志信息
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <appender class="org.apache.log4j.ConsoleAppender" name="console"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n" /> <!-- param name="ConversionPattern" value="=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n" /--> </layout> </appender> <appender class="org.apache.log4j.RollingFileAppender" name="file"> <param name="File" value="MengBackup.log" /> <param name="MaxFileSize" value="100KB" /> <param name="MaxBackupIndex" value="2" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n" /> </layout> </appender> <logger name="com.ibatis"> <level value="debug" /> </logger> <logger name="com.ibatis.common.jdbc.SimpleDataSource"> <level value="debug" /> </logger> <logger name="com.ibatis.common.jdbc.ScriptRunner"> <level value="debug" /> </logger> <logger name="com.ibatis.common.jdbc.SqlMapClientDelegate"> <level value="debug" /> </logger> <logger name="java.sql.Connection"> <level value="debug" /> </logger> <logger name="java.sql.Statement"> <level value="debug" /> </logger> <logger name="java.sql.PreparedStatement"> <level value="debug" /> </logger> <logger name="java.sql.ResultSet"> <level value="debug" /> </logger> <root> <priority value="DEBUG" /> <appender-ref ref="console" /> <appender-ref ref="file" /> </root> </log4j:configuration>