Turning off logging for Hibernate c3p0

Do you not want to see any c3p0 logging?

If so try:

Logger.getLogger("com.mchange.v2.c3p0").setLevel(Level.WARNING);

OR, if you don't even want to see the first line of the log:

Logger.getLogger("com.mchange.v2").setLevel(Level.WARNING);

The way I found is to set the system property

System.setProperty("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");

in addition to

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

I thought, that absence of any other logging system wil make that optional, but it seems, that I was wrong.

P.S.

Damn those wheel-reinvented custom logging implementations, like the one used by c3p0...


The way I found for achieving this

Create in your classpath a file called mchange-log.properties and put into it properties suggested by Frozen Spider.

com.mchange.v2.log.MLog=com.mchange.v2.log.FallbackMLog
com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL=WARNING

Thats work fine even when you are not able to set system properties directly.


It appears that c3p0 logging defaults to DEBUG. That can result in a lot of noise.

By adding a line like this to log4j.properties, you are telling the logger not to bother you with c3p0 messages - unless it's something important:

log4j.logger.com.mchange.v2=WARN