Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails plugin for showing line numbers in log for SQL queries

Does anybody know any plugin, that can show line numbers for SQL queries in Rails logs? Something like this:

User Load (0.003154)   SELECT * FROM `users` WHERE (`users`.`id` = 1) - (user.rb, line 24)

Thanks!

like image 680
Yojik Avatar asked Nov 07 '08 03:11

Yojik


1 Answers

This plugin puts the stack trace in your logs. As Daniel mentions it would be tricky to determine the line you wanted but I suspect you could work something out, and the trace itself may be good enough.

https://github.com/ruckus/active-record-query-trace

Be careful to set it up so you can turn it on and off. I used this for awhile, and while useful for tracking down specific bugs, it drove me nuts if it was on all the time.

like image 133
Cameron Price Avatar answered Oct 23 '22 03:10

Cameron Price