I had no idea logging supported such a feature.
However, I do know that intrinsic in a feature like that, is that determining
"source line" needs to be configurable via a "depth", that is, how many source
lines up should it go up the chain of "sources" for that call, since any
particular call to logging will be at the end of a chain of ancestor calls.
If this logging feature doesn't support that, then it's kind of useless - use
an event handler instead which pulls out the current stack frames and steps
upwards the appropriate number of steps before reporting the "source line".
On Jun 28, 2012, at 1:32 PM, Sebastian Elner wrote:
> Hello,
>
> I have an app here, which issues quite a number of sql statements. I would
> like to track down where in the code the sql is issued. Setting echo to True
> does not give the .py file and line number, so I setup my own logger as
> described in the docs:
>
> import logging
> logging.basicConfig()
> logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
>
>
> adding a format argument to basicLogging for printing the file path and line
> number. But I always get base.py and the cursor_execute line.
> Any chance of making this work?
>
> Cheer
>
> Sebastian
>
>
>
>
> --
> Sebastian Elsner - pipeline td - r i s e | fx
>
> t: +49 30 20180300 [email protected]
> www.risefx.com
>
> r i s e | fx GmbH
> Schlesische Strasse 28 Aufgang B, 10997 Berlin
> Geschäftsführer: Sven Pannicke, Robert Pinnow
>
> Handelsregister Berlin HRB 106667 B
>
> --
> 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.
>
--
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.