Finding the line of code corresponding to an SQL statement

Wondering if any one has suggestions for changing the log output such
that the line of code (and associated file) that resulted in a query
is output to the log file when running in the development env.

for example:

ActionTracker Load (0.016000) [0m [0;1mSELECT * FROM
action_trackers WHERE (name=‘topicviews’ and entity_id=93 and
user_id=88) LIMIT 1 [0m
<- action_tracker.rb - line #45

You could try using a custom logger like log4r, or attempt to
customize AR itself.

On Mar 4, 2008, at 3:36 PM, tshim wrote:

for example:

ActionTracker Load (0.016000) [0m [0;1mSELECT * FROM
action_trackers WHERE (name=‘topicviews’ and entity_id=93 and
user_id=88) LIMIT 1 [0m
← action_tracker.rb - line #45

Check out:

http://terralien.com/projects/querytrace/

fantastic! exactly what I was looking for!

Wondering if any one has suggestions for changing the log output such
that the line of code (and associated file) that resulted in a query
is output to the log file when running in the development env.

http://agilewebdevelopment.com/plugins/sql_logging