1. Log
C3p0 comes with a mchange-commons package, which implements a log framework on its own. This is used by default. Causes the program to use Logback and C3P0 but uses its own mchange-commons. There are two options for solving this problem:
A. Configuring mchange-commons
Create a new "mchange-log.properties" file in Classpath.
#日志框架 default is fallbackmlog#com.mchange.v2.log.mlog=com.mchange.v2.log.fallbackmlog# if you use Logback, Need to change to Com.mchange.v2.log.mlog=com.mchange.v2.log.slf4j.slf4jmlog#fallbackmlog's log level, This item is invalid when using a different log frame Com.mchange.v2.log.fallbackmlog.default_cutoff_level=com.mchange.v2.log.fallbackmlog.all
B. Setting system variables in a program
Configure the C3P0 log implementation Properties P = new properties (System.getproperties ());p. Put ("Com.mchange.v2.log.MLog", " Com.mchange.v2.log.slf4j.Slf4jMLog ");p. Put (" Com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL "," INFO "); The log implementation is not fallbackmlog. This value does not take effect. System.setproperties (P);
C. Configuring logs for log4j
Log4j.logger.com.mchange.v2.c3p0=severe
2. Configuration
C3P0 's pit.