Is logging all sql queries possible with DEBUG=False (staging environment)?

Yes, I’m sure it’s possible - I’m just not sure of the specifics necessary to do so.

<conjecture>
I’m guessing the easiest way may be to override the DatabaseWrapper class to set the force_debug_cursor attribute True. (See Database instrumentation at a higher layer as an example. Note: You can ignore all the stuff related to the SQL compiler. I believe that all you may need is to define the DatabaseWrapper class, override the attribute, and set that class as the engine.)

You might also be able to do this by importing your Database Engine class in the settings file and monkey-patch it.
</conjecture>

1 Like