# How to monitor generated SQL output?

**URL:** <https://www.ruby-forum.com/t/how-to-monitor-generated-sql-output/187293>\
**Category:** Rails\
**Created:** [April 21, 2010, 9:30am UTC](https://www.ruby-forum.com/t/how-to-monitor-generated-sql-output/187293 "2010-04-21T09:30:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fearless\_fool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5e9695/32.png) [@fearless\_fool](https://www.ruby-forum.com/u/fearless_fool)\
**Post date:** [April 21, 2010, 9:30am UTC](https://www.ruby-forum.com/t/how-to-monitor-generated-sql-output/187293/1 "2010-04-21T09:30:53Z")

</div>

Pardon if this has been asked a dozen times before (a quick search on  
the forum didn’t turn up anything obvious):

For purposes of really understanding ActiveRecord, is there an easy way  
to watch the SQL generated calls to ActiveRecord.find() etc? I’m  
running in the console – not under a web server – so not everything  
gets logged.

- ff

---

<div class="post-metadata">

**Author:** ![fearless\_fool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5e9695/32.png) [@fearless\_fool](https://www.ruby-forum.com/u/fearless_fool)\
**Post date:** [April 21, 2010, 10:00am UTC](https://www.ruby-forum.com/t/how-to-monitor-generated-sql-output/187293/2 "2010-04-21T10:00:34Z")

</div>

On Apr 21, 8:30 am, Fearless F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Pardon if this has been asked a dozen times before (a quick search on  
> the forum didn’t turn up anything obvious):
> 
> For purposes of really understanding ActiveRecord, is there an easy way  
> to watch the SQL generated calls to ActiveRecord.find() etc? I’m  
> running in the console – not under a web server – so not everything  
> gets logged.

It should still all go into the log file (in development mode at  
least).

Fred

---

<div class="post-metadata">

**Author:** ![fearless\_fool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5e9695/32.png) [@fearless\_fool](https://www.ruby-forum.com/u/fearless_fool)\
**Post date:** [April 21, 2010, 10:18am UTC](https://www.ruby-forum.com/t/how-to-monitor-generated-sql-output/187293/3 "2010-04-21T10:18:55Z")

</div>

Frederick C. wrote:

> It should still all go into the log file (in development mode at  
> least).
> 
> Fred

You’re right as always! 🙂

Somehow, I got my script/console session in a state where it wasn’t  
logging to log/development.log (not even Rails.logger.debug() was  
working). I quit and restarted the session, and now it seems to be  
logging away happily.

Thank you, and thank goodness for tail -f log/development.log…

- ff
