How to monitor generated SQL output?

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

On Apr 21, 8:30 am, Fearless F. [email protected] 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

Frederick C. wrote:

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

Fred

You’re right as always! :slight_smile:

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