Never mind. Isn't it always how it goes that you spend forever on something, finally reduce to asking someone else, then figure it out soon thereafter?
Anyway... the only thing I needed to do was do the logger config in advance of creating the engine. Which makes me wonder how I go about changing the logging behaviour on the fly, but I don't plan on doing that at the moment so am not going to worry about it. On Jun 30, 1:08 pm, Russell Warren <[EMAIL PROTECTED]> wrote: > I must be missing something simple, but with SQLA 0.4.6 I can't get > the logging to work without using the echo flag. When I do set echo = > True and leave my logging configuration code I get the double logging > problem mentioned in the docs. > > My apologies if this is just a logging module issue. The primary bit > of documentation I'm using is > this:http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_logging > > but I've also been digging around the logging.py docs and code without > any luck. > > Below is a standalone script I've reduced to that demonstrates the > problem. What do I need to do to make this output the SQL statements > to stdout? > > #### > import sqlalchemy as sa > from sqlalchemy.ext.declarative import declarative_base > import logging > > _ORM_BASE = declarative_base() > > class ORM_User(_ORM_BASE): > __tablename__ = "user" > id = sa.Column("id", sa.Integer, primary_key = True) > login = sa.Column("login", sa.String(80), index = True, unique = > True) > password = sa.Column("password", sa.String(80), nullable = False) > > DbEngine = sa.create_engine('sqlite:///:memory:', echo = False) > > logging.basicConfig(format = '%(message)s') > engineLogger = logging.getLogger('sqlalchemy.engine') > assert isinstance(engineLogger, logging.Logger) > assert engineLogger is not logging.root > engineLogger.setLevel(logging.DEBUG) # to get statements and results > > _ORM_BASE.metadata.create_all(DbEngine) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
