engine.echo = False doesn't work

Issue #1554 resolved
Former user created an issue

Setting {{{engine.echo = False}}} does not suppress SQL logging if the parent logger (sqlalchemy.engine) is INFO or DEBUG. This makes it impossible to shut up an oververbose engine while logging other engines. The problem is that the log level is set to NOTSET rather than WARN, so it inherits the level of its parent logger. But that's counterintuitive because if somebody sets echo=False, they intend to suppress logging. echo=None would be a value suitable to restore the default behavior.

This also gets into the logger name, which I'll address in another ticket.

Comments (3)

  1. Mike Bayer repo owner
    • changed component to engine
    • changed milestone to 0.6.0

    echo was never meant to be used if the application is making explicit use of logging. There's many reasons they can't really work together, not the least of which is that "echo" does a logging.basicConfig() and sets up a handler unconditionally.

    but a setting of False can set WARN and None would to NOTSET, I don't think that would get in anyone's way...but we can also target it for 0.6 so that there's a hard boundary of the new behavior. Hope that's OK.

  2. Log in to comment