Thursday, October 11, 2012

using c3p0 with logback


Problem statement: My web application is using logback framework for logging and I can see the cataline.out growing rapidly due to debug logs from com.mchange.v2 classes. logback.xml configurations does not work for me.

Solution: create file mchange-log.properties in your classpath with the following content
com.mchange.v2.log.MLog=com.mchange.v2.log.FallbackMLog
com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL=OFF

Note: c3p0 uses a different logging mechanism which works with log4j and jdk14logging. To use it with logback you need to use the FallBackMlog implementation.