用log4j打印mybatis 连接数据库SQL语句无法打印,用的是c3po连接池

log4j配置如下:
log4j.rootLogger=info, stdout,file

log4j.logger.org.springframework=INFO
log4j.logger.org.springframework=ERROR

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %-5p %c %L %x - %m%n
log4j.logger.com.credata.dao.assetmagt=trace
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.DatePattern='.'yyyy-MM-dd
log4j.appender.file.Encoding=UTF-8
log4j.appender.file.File=d:/log/numprest.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %5p [%t-%X] %c(%F:%L) - %m%n

打印控制台信息如下:
[2015-11-12 11:37:13,742] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource 462 - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 2, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 3000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hgfevb9c1xav6gr1fjvgn4|515f9503, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.driver.OracleDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgfevb9c1xav6gr1fjvgn4|515f9503, idleConnectionTestPeriod -> 60, initialPoolSize -> 5, jdbcUrl -> jdbc:oracle:thin:@172.20.8.187:1521:bppmdb, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 60, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
[2015-11-12 11:37:14,721] INFO com.nantian.nump.rest.DeviceRest 47 - 测试通过
[2015-11-12 11:37:15,327] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource 462 - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 2, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 3000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hgfevb9c1xav6gr1fjvgn4|6c540ae7, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.ibm.db2.jcc.DB2Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgfevb9c1xav6gr1fjvgn4|6c540ae7, idleConnectionTestPeriod -> 60, initialPoolSize -> 5, jdbcUrl -> jdbc:db2://172.20.8.188:50001/nrptdev, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 60, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
[com.nantian.nump.bean.Server@42433dc1, com.nantian.nump.bean.Server@4c8b6be3, com.nantian.nump.bean.Server@55582b57, com.nantian.nump.bean.Server@f858887]
[2015-11-12 11:37:15,893] INFO com.nantian.nump.rest.DeviceRest 59 - 采集数据成功!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐