Rails’ ActiveRecord displays the exact SQL queries it performs into the development log. It is inconvenient to watch this log while you’re working in the `script/console` environment, however, and most advice for redirecting that log to STDOUT seemed not to work. Thanks to [Jamis Buck](http://weblog.jamisbuck.org/2007/1/31/more-on-watching-activerecord “More on watching ActiveRecord”), though, the solution has come to light:
ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Base.clear_active_connections!
The key is the clear_active_connections! call. ActiveRecord caches its logger for performance purposes, and if any ActiveRecord calls have happened before the console finishes loading, you can change the Base.logger until the end of time and never see the SQL logged as you expect.