Is there a way to find which line of code generated a MySQL statement in a Rails development log?
In order to do some performance optimization, I would like to find which part of my app is creating which MySQL queries. When I take a look at my log, I see hundres of queries flashing around on each web request I do, and I need to find out where they come from.
I'm thinking about adding some variables like ____FILE____
and ____LINE____
to the log output.
Is that possible?
https://github.com/lightyear/sql-logging gives you a backtrace for every SQL query plus a bunch of useful statistics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With