码迷,mamicode.com
首页 > 数据库 > 详细

mybatis 打印sql log配置

时间:2016-06-28 12:24:23      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:

mybatis 打印sql log, 方便调试。如何配置呢?

log4j.xml :

<!-- 打印sql start -->
    <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>
     
    <!-- 打印sql end -->

 

mybatis 打印sql log配置

标签:

原文地址:http://www.cnblogs.com/chenmo-xpw/p/5622917.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!