打印出的sql
2014-04-09 09:45:01,932 104536 INFO [AbstractPoolBackedDataSource.java:462] : Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> Test, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge72g91iwrlz91rt05ar|1f9cdda, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge72g91iwrlz91rt05ar|1f9cdda, idleConnectionTestPeriod -> 1800, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://10.10.182.33:3306/desktop_312?useUnicode=true&characterEncoding=UTF-8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 7200, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 2, maxStatements -> 100, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> true, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
2014-04-09 09:45:01,970 104574 DEBUG [Slf4jImpl.java:28] : ooo Connection Opened
2014-04-09 09:45:02,375 104979 DEBUG [Slf4jImpl.java:28] : ==> Executing: select t.AREA_ID as areaId, t.PRODUCT_TYPE as productType, t.RESOUCE_INFO as resouceInfo, t.USER_ID as userId, t.STATE as state, t.PRODUCT_COUNT as productCount, t.CREATE_TIME as createTime, t.ID as id, t.UPDATE_TIME as updateTime , t2.NAME as userName, t3.NAME as areaName from ORDERS t LEFT JOIN AD_USER t2 on t.USER_ID = t2.ID LEFT JOIN SYS_AREA t3 ON t.AREA_ID = t3.ID where 1 = 1 and t.AREA_ID in ( ? , ? ) and t.STATE in ( ? , ? )
2014-04-09 09:45:02,376 104980 DEBUG [Slf4jImpl.java:28] : ==> Parameters: 7(Integer), 5(Integer), apply(String), abk(String)
log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- 标准控制台输出 -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<!-- 关闭向catalina.out中输出日志, 避免该日志文件无限增长, 调试时可以将此选项调整为DEBUG -->
<param name="Threshold" value="ON" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} %r %-5p [%F:%L] : %m%n" />
</layout>
</appender>
<!-- 服务器主日志文件 -->
<appender name="server.rolling.file" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Threshold" value="info" />
<!-- The active file to log to -->
<param name="file" value="${catalina.home}/logs/skyform-job.log" />
<param name="Append" value="false" /><!-- 设置是否在重新启动服务时,在原有日志的基础添加新日志 -->
<param name="append" value="true" />
<param name="encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The log message pattern -->
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} %r %-5p [%F:%L] : %m%n" />
</layout>
</appender>
<!-- 公共组件日志 -->
<logger name="org.springframework" additivity="true">
<level value="info" />
<appender-ref ref="stdout" />
<appender-ref ref="server.rolling.file" />
</logger>
<logger name="org.apache" additivity="true">
<level value="info" />
<appender-ref ref="stdout" />
<appender-ref ref="server.rolling.file" />
</logger>
<logger name="freemarker" additivity="true">
<level value="info" />
<appender-ref ref="stdout" />
<appender-ref ref="server.rolling.file" />
</logger>
<logger name="catalia" additivity="true">
<level value="info" />
<appender-ref ref="stdout" />
<appender-ref ref="server.rolling.file" />
</logger>
<!-- 下面是打印mybatis语句的配置-->
<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" />
</logger>
<logger name="java.sql.ResultSet" additivity="true">
<level value="DEBUG" />
</logger>
<root>
<priority value="info" />
<appender-ref ref="stdout" />
<appender-ref ref="server.rolling.file" />
</root>
</log4j:configuration>