I need to intercept all queries to DB and write them to the file log.
So, if base operations like DELETE, UPDATE and CREATE I can intercept with signals framework. But what about READ queries? How can I catch them with signals?
Another way is to create custom middleware, and process queries in it
class SQLLoggingMiddleware(object): def process_request(self, request): from django.db import connection for query in connection.queries: #... do something with query