log4j.xml

log4j:
打印sql配置
<?xml version="1.0" encoding="GBK" ?>
<!DOCTYPE log4j:configuration SYSTEM "http://toolkit.alibaba-inc.com/dtd/log4j/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <!-- ===================================================================== -->
    <!--  appender 配置                                                        -->
    <!-- ===================================================================== -->
    <appender name="whcConsole" class="org.apache.log4j.ConsoleAppender">      
        <param name="append" value="true"/>
        <param name="encoding" value="GBK"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [] %-5p %c{2} - %m%n"/>
        </layout>      
    </appender>
    <appender name="whc" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="file" value="${whc.loggingRoot}/whc.log"/>
        <param name="append" value="true"/>
        <param name="encoding" value="GBK"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [] %-5p %c{2} - %m%n"/>
        </layout>
    </appender>
     <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.sqlmap.client.SqlMapClient">
  <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" />
</logger>


    <!-- ===================================================================== -->
    <!--  其余内容打到 root logger                                 -->
    <!-- ===================================================================== -->
    <root>
        <level value="debug"/>
        <appender-ref ref="whc"/>
        <appender-ref ref="whcConsole"/>
    </root>
</log4j:configuration>

你可能感兴趣的:(log4j)