#54 Can't turn off init log message

open
nobody
None
5
2007-07-14
2007-07-14
No

This is crazy but I can't seem to turn off the initial init log message (Initializing c3p0 pool...). I tried changing the log4j level to warning (via log4.properites), the fallback method level to warning (via c3p0.properties), even change the log level via a code call but still not turning off. Any idea what I am doing wrong?

Discussion

  • Steve Waldman
    Steve Waldman
    2007-07-15

    Logged In: YES
    user_id=175530
    Originator: NO

    First thing to check -- what logger is c3p0 logging to? There should be an init message (at info in your logs) about "MLog clients" or something like that, that reveals what c3p0 ends up logging to. What does it say?

     
  • Logged In: YES
    user_id=99264
    Originator: YES

    Well at info I see the following. What is weird is that the all the c3p0 log messages other then "Init..." show up in my specified log4j format and turn off when I set log4j to warn. The "Init..." msg does not have my specified log4j format and is not effected. I thought that one it was clear log4j controlled the messages, they would all be controlled by log4j. Also, just FYI it is being run from within ant script as a stand along java program.

    [java] 2007-07-15 17:02:01,382 INFO main C3P0ConnectionProvider:50 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://*******:3306/cms2
    [java] 2007-07-15 17:02:01,384 INFO main C3P0ConnectionProvider:51 - Connection properties: {user=*********, password=**********}
    [java] 2007-07-15 17:02:01,384 INFO main C3P0ConnectionProvider:54 - autocommit mode: false
    [java] Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@72ffb [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@19209ea [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, maxIdleTime -> 1800, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@18fd984 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://*******:3306/cms2, properties -> {user=******, password=******} ] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> 72ffb ]
    [java] 2007-07-15 17:02:01,858 INFO main SettingsFactory:77 - RDBMS: MySQL, version: 4.1.22-standard

     
  • Steve Waldman
    Steve Waldman
    2007-07-16

    Logged In: YES
    user_id=175530
    Originator: NO

    valcar, none of those other messages are c3p0. C3P0ConnectionProvider is a Hibernate class. It looks like c3p0 is logging to something else. Again, there should be an explicit message about MLog client. Also, there should be a banner indicating c3p0's version (and that is always helpful for me to see as well).

    If these messages aren't present, it means you are using a very old version of c3p0, and should definitely upgrade. (Very, very old versions of c3p0 log to stderr and nothing can be done, but that was years and lifetimes ago.) Anyway, do just upgrade to the latest. It's a simple matter of moving the old c3p0 jar out of hibernate's lib directory and dropping the new jar file in its place. It's painless. Then look for explicit messages about versions, and which logger is being used.