Skip to content

Instantly share code, notes, and snippets.

@dsueiro
Created February 11, 2011 20:22
Show Gist options
  • Select an option

  • Save dsueiro/822951 to your computer and use it in GitHub Desktop.

Select an option

Save dsueiro/822951 to your computer and use it in GitHub Desktop.
Log sql to console both in Rails 2.3 and Rails 3
require 'logger'
if ENV.include?('RAILS_ENV')&&
!Object.const_defined?('RAILS_DEFAULT_LOGGER')
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
else
ActiveRecord::Base.logger = Logger.new(STDOUT)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment