Quick answer so I can post some more text.
The answer suggested by Chris de Gelder was:
build your own profiler on the connectionbus and log the queries?
For an example of this, you can take a look at the Profiler Module on the App Store. As its creator I can answer any questions concerning it.
It works by hooking into incoming client requests and following these through the runtime (you can see the first microflow that is called, if applicable) and into the database.
You can set up the module in any project you want. Simply activate it, click around and go to the overview screen. All the information that can be tracked with it is shown here as shown in the screenshots.