Vinay Sajip wrote:
>
> Hi,
>
> I've just been discussing Python's logging package with Armin Ronacher
> of Pocoo over on stdlib-sig:
>
> http://mail.python.org/pipermail/stdlib-sig/2009-September/000671.html
>
> In that post, Armin says that the SQLAlchemy development team had a
> lot of problems with Python logging and had to do an "Incredible
> dance" relating to loggers for temporary database connections.

hmmm OK I think what he may be referring to is that we have this flag
called "echo" which works like this:

engine = create_engine(url, echo=True)

what "echo" does is a "shortcut" to setting up logging and enabling INFO
logging for the logger named "sqlalchemy.engine".   In order to ensure
output, it does a basicConfig() to standard out.

What happens though, particularly when people use Pylons or similar, is
that they have a logging configuration in their conf file, which already
sets up handlers for logging.  then they'd like to use the "echo" flag for
debugging, but it ends up setting up a second handler, so in the case of
already logging to stdout you get double log messages.

It would be nice if there were some APIish way we could check that
handlers have already been configured, so that the "echo" flag wouldn't do
a second handler configuration.


> Seriously, as the author of the logging package, I'm sorry if you've
> had any problems with logging, and I'm reasonably responsive to issues
> raised on Python's bug tracker. I don't recall seeing anything from
> the SQLAlchemy developers,but I could have missed it.

the "echo" issue is not really a big deal.  the other issue we have is one
I'm not sure much can be done about.  We have logging calls which we would
like to make within extremely performance critical sections, like when
fetching results.  However if you look at our source code we jump through
hoops to avoid an unnecessary method call, like:

if self._should_log_debug:
    self.log_debug(...)

otherwise the log_debug() would result in about three method calls per row
even when logging is disabled.   A bad side effect of this is that in many
cases _should_log_debug is determined when an engine or session is first
created (based on logging.isDebugEnabled() etc.) - so an application has
to take care to set up their logging config before the rest of their
SQLAlchemy objects are generated.

Those are pretty much the only two things we have, thanks for the interest !

> P.S. I think SQLAlchemy is great!

thanks !



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to