Disable c3p0 logs

c3p0 2.jpg

This post covers how to disable c3p0 (database connection pooling) logs printing on console or writing in log files even you have configured SLF4J and logback/SLF4j and log4j.

This is the output of my logfile before disabling the c3p0 logs.

log01

We can disable by adding these do the main method.


public static void main(String[] {
System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "WARNING");
System.setProperty("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
// Rest of the code
}

view raw

LogDisable.java

hosted with ❤ by GitHub

This is the log file output after the code modification.

log02

Thank you for reading the post and hope it will help you.

Leave a comment