Consider changing logging level of sqlalchemy.pool.Pool from .info() to .debug()

Issue #1583 resolved
Paul Harrington created an issue

We use SQLAlchemy for connection pool management and recently made some changes such that log-levels selected from the command-line are passed down to SQLAlchemy. A number of developers would prefer if the "Connection %r checked out from pool" message was issued at debug level rather than info.

We can workaround the issue by monkey-patching sqlalchemy.pool.Pool.log as follows:

sqlalchemy.pool.Pool.log = lambda self, msg, args: self.logger.debug(msg, args)

I am pretty agnostic about log-levels but the topic can raise quite a bit of excitement!

pjjH

Comments (6)

  1. Mike Bayer repo owner
    • changed milestone to 0.6.0

    I kind of like this idea but as its an abrupt change I'd like to see some of their arguments, i.e. some guidance on what they see as the definition of INFO and DEBUG. the python docs didn't seem to say much.

  2. Paul Harrington reporter

    Here are a sample of the comments. Note that --verbose is a standard command-line option that sets logging level to INFO.

    thanks, pjjH

    I don't think they are important enough to be info(). These should be debug or trace messages, really. I would like to be able to turn on info messages to get important non-failure notifications without getting lots of chatter from every module I call into.

    In my mind (though I don't claim to be an authority): error = Something went wrong. warning = Something might have gone wrong or is about to go wrong. info = Something notable occurred, or here's an extremely useful piece of information. debug = Here's a piece of information that is useful for debugging problems in the code. trace = This is what I'm doing right now.

    To me, setting echo=True feels like setting DEBUG, not INFO. My vague feeling is that echo=True produces way more output than I’d expect from INFO. I don’t really have any answers here, just trying to discern why the --verbose behavior felt wrong to me.

  3. Paul Harrington reporter

    I meant to write:

    --verbose is our standard command-line option and it sets the logging level to INFO.

  4. Mike Bayer repo owner

    ok so pool should have info() for things like "dispose" and perhaps "invalidated". we'd move the rest to debug().

  5. Log in to comment