C3P0 's pit.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.