<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
	<!-- 根据需要进行添加 -->
	<!-- 输出到控制台 -->
	<appender name="console" class="org.apache.log4j.ConsoleAppender">
		<param name="Threshold" value="info"></param>
		<layout class="org.apache.log4j.TTCCLayout">
			<param name="ConversionPattern" value="TTCCLayout"></param>
		</layout>
	</appender>

	<!-- 输出日志到文件 每天一个文件 -->
	<appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
		<param name="Threshold" value="info"></param>
		<param name="ImmediateFlush" value="true"></param>
		<param name="File" value="logs/dailyRollingFile.log"></param>
		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'"></param>
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
		</layout>
	</appender>

	<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->
	<appender name="railyFile" class="org.apache.log4j.RollingFileAppender">
		<param name="File" value="logs/railyFile.log"></param>
		<param name="ImmediateFlush" value="true" />
		<param name="Threshold" value="info"></param>
		<param name="Append" value="true"></param>
		<param name="MaxFileSize" value="30KB"></param>
		<param name="MaxBackupIndex" value="100"></param>
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
		</layout>
	</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>

	<!-- 定义全局的日志输出级别,但是在输出目的地的配置中配置的具体输出级别优先级高于全局定义的优先级。 如果在railyFile中定义<param 
		name="Threshold" value="info"></param>,那么将会把info以上级别的信息输出 -->
	<root>
		<priority value="debug" />
		<appender-ref ref="console" />
		<appender-ref ref="dailyRollingFile" />
		<appender-ref ref="railyFile" />
		<appender-ref ref="file" />
	</root>
</log4j:configuration>