On Oct 17, 2008, at 9:22 AM, Ids wrote:
>
> Hi,
>
> I'm using SQLA 0.5.0rc2 and am running into a problem. I've got a
> piece of code like this:
> import sys
> import logging
> import sqlalchemy as sa
> from sqlalchemy.orm import sessionmaker
>
> logging.basicConfig(stream=sys.stderr)
> logging.getLogger('sqlalchemy.pool').setLevel(logging.ERROR)
>
> engine = sa.create_engine(.....)
>
> logging.getLogger('sqlalchemy.pool').setLevel(logging.INFO)
>
> In the example above I won't see any INFO log messages. However, if
> you change the first setLevel from logging.ERROR to logging.INFO you
> _do_ get INFO log messages. It looks like you have to specify a
> loglevel below logging.WARN *before* creating the engine. Otherwise I
> can't get any logging to work.
>
> Maybe it's my lack of understanding the logging module, but does
> someone know what is going on?
the engine checks the log levels when its first constructed, and
sticks with those. this is because the logging.isEnabledFor() call is
apparently very expensive.
to change the engine's log behavior after creation you can use the
"echo" flag as an alternative. This flag has some of its own opinions
about logging though which may or may not get in the way of what
you're trying to accomplish.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---