禁用误报C3P0日志

时间:2017-02-09 20:34:24

标签: java logging log4j c3p0

我的Java7项目使用c3p0(0.9.5.1)进行连接池,使用Log4j(1.2.17)进行日志记录。似乎log4j以错误级别记录c3p0 INFO日志:

2017-02-09T21:30:19.545+01:00 app_r41 jsvclog[5135] err: JSVC [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
2017-02-09T21:30:19.959+01:00 app_r41 jsvclog[5135] err: JSVC [main] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.1 [built 16-June-2015 00:06:36 -0700; debug? true; trace: 10]
2017-02-09T21:30:21.294+01:00 app_r41 jsvclog[5135] err: JSVC [main] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - [configuration of ComboPooledDataSource follows here...]

现在这令人困惑,我想禁用它。

这是我的log4j.properties配置的相关部分:

log4j.rootLogger=INFO, SYSLOG_APPENDER
log4j.logger.com.mchange=WARN, SYSLOG_APPENDER

我错过了什么?

1 个答案:

答案 0 :(得分:0)

在服务启动期间设置此系统属性可解决问题:

System.setProperty( "com.mchange.v2.log.Log4jMLog.DEFAULT_CUTOFF_LEVEL", "WARNING" );