Search code examples
javahibernatelog4jslf4jc3p0

Using slf4j with c3p0 and Hibernate


I'm trying to get my c3p0 to log to slf4j (log4j backend).

The c3p0 documentation, says that this property will do the trick:

com.mchange.v2.log.MLog=com.mchange.v2.log.slf4j.Slf4jMLog 

However, c3p0 gives the error on startup:

Tried without success to load the following MLog classes:
    com.mchange.v2.log.log4j.Log4jMLog

I have included Hibernate c3p0, using Gradle:

compile group: 'org.hibernate', name: 'hibernate-c3p0', version: '4.3.6.Final'

It includes a c3p0 0.9.2.1 jar, which does not have this MLog class. So i explicitly include c3p):

compile group: 'c3p0', name: 'c3p0', version: '0.9.1.2'

...which does have the class, but c3p0 still refuses to load it (same error) - i guess because of a c3p0 version conflict, the old version is ignored.

Not sure where to go from here; any help will be appreciated.


Solution

  • slf4j support is a c3p0 0.9.5 feature.

    please try upgrading to c3p0 0.9.5-pre9.