在ibatis中打印sql语句

xiaoxiao2021-02-27  286

web.xml中配置:

<!--初始化 log4j --> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>WEB-INF/classes/config/log4j.xml</param-value> </context-param>

:log4j.xml:

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender" > <layout class="org.apache.log4j.PatternLayout"> <!-- param name="ConversionPattern" value="%p - %C{1}.%M(%L) | %m%n"/--> <param name="ConversionPattern" value="%t [%-5p] %d{HH:mm:ss} %c - %m%n" /> <param name="Encoding" value="UTF-8" />   </layout> </appender> <logger name="org.apache.catalina"> <level value="ERROR" /> </logger> <logger name="com.ibatis"> <level value="ERROR" /> </logger> <logger name="com.dota.framework"> <level value="INFO"/> </logger> <logger name="com.pms"> <level value="ERROR"/> </logger> <logger name="org.springframework"> <level value="INFO"/> </logger> <logger name="org.springframework.aop.framework.Cglib2AopProxy"> <level value="ERROR"/> </logger> <logger name="java.sql"> <level value="DEBUG"/> </logger> <root> <level value="INFO" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> <!-- <appender-ref ref="WS" /> --> </root> </log4j:configuration>

转载请注明原文地址: https://www.6miu.com/read-3299.html

最新回复(0)