# Changing where ActiveRecord logs to in the console

**URL:** <https://www.ruby-forum.com/t/changing-where-activerecord-logs-to-in-the-console/186174>\
**Category:** Rails\
**Created:** [April 1, 2010, 4:49pm UTC](https://www.ruby-forum.com/t/changing-where-activerecord-logs-to-in-the-console/186174 "2010-04-01T16:49:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@nickh](https://www.ruby-forum.com/u/nickh)\
**Post date:** [April 1, 2010, 4:49pm UTC](https://www.ruby-forum.com/t/changing-where-activerecord-logs-to-in-the-console/186174/1 "2010-04-01T16:49:35Z")

</div>

G’day folks. In the Rails console, if you configure ActiveRecord’s  
logger to output to STDOUT, like this:

ActiveRecord::Base.logger = Logger.new STDOUT

how do you switch it back to writing to a file? I tried the 2 lines  
below separately, but AR still logs to STDOUT afterwards:

ActiveRecord::Base.logger = Logger.new  
“#{RAILS\_ROOT}/log/#{RAILS\_ENV}.log”

ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new  
“#{RAILS\_ROOT}/log/#{RAILS\_ENV}.log”

Here’s a quick summary of what I’ve found:  
[http://pastie.org/898868](http://pastie.org/898868)

Any ideas? Thanks,  
Nick
