From: Oleg B. <ph...@ph...> - 2009-10-13 07:45:52
|
On Tue, Oct 13, 2009 at 08:52:48AM +0200, Lutz Steinborn wrote: > is there a way to log the query that SQLObject generates ? Sure. You can turn on debug flag in DB URI or connection: __connection__ = 'sqlite:///path/to/db?debug=1' With debug turned on SQLObject prints queries to stdout, so you can redirect the stdout of your program or sys.stdout. You can also redirect this printing to stderr: __connection__ = 'sqlite:///path/to/db?debug=1&loglevel=stderr' To use logging instead of printing you have to name both the logger and the loglevel: __connection__ = 'sqlite:///path/to/db?logger=sqllog&loglevel=debug' 'logger' is any log name, see http://sqlobject.org/SQLObject.html#dbconnection-database-connections for details on configuring logging. 'loglevel' in this case must be a logging method (debug, info, warning, error, critical, exception). SQLObject (DBConnection, actually) emits a number of logging messages, see method printDebug at http://svn.colorstudy.com/SQLObject/trunk/sqlobject/dbconnection.py Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |