Commands issued during migration operations are already saved to 
/databases/sql.log. If you want all commands (i.e., queries), note that on 
each request, there is db._timings, which is a list of tuples, where the 
first element of each tuple is the SQL command issued and the second 
element is the amount of time it took to execute. At the end of every 
request, you could dump the contents of db._timings to a log. You can do 
that by assigning a callback function to response._caller(), which wraps 
all calls to controller actions. Note, it will therefore miss any queries 
that are run in views, but it's probably not a good idea to run queries in 
views anyway. You could also set up middleware to do the 
logging: 
http://web2py.com/books/default/chapter/29/04/the-core?search=_caller#WSGI.

Anthony

On Saturday, March 16, 2019 at 4:54:52 PM UTC-4, João Matos wrote:
>
> Hello,
>
> I would like to log of all SQL commands web2py sends to SQLlite. Is it 
> possible?
>
> Thanks,
>
> JM
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to