第1个回答 2015-12-19
<!-- SQL日志 -->
<appender name="sqlLogAppender" class="com.qunar.flight.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.base}/logs/mybatis.log"/>
<param name="Encoding" value="UTF-8" />
<param name="DatePattern" value="'.'yyyy-MM-dd-HH'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} %p [%t][%X{traceId} %X{uid}] %x - %m%n" />
</layout>
</appender>
<logger name="java.sql" additivity="true">
<level value="DEBUG" />
<appender-ref ref="sqlLogAppender" />
</logger>
<logger name="com.ibatis" additivity="true">
<level value="DEBUG" />
<appender-ref ref="sqlLogAppender" />
</logger>本回答被提问者采纳