Skip to content

Instantly share code, notes, and snippets.

@wongyouth
Created June 7, 2013 14:36
Show Gist options
  • Save wongyouth/5729704 to your computer and use it in GitHub Desktop.
Save wongyouth/5729704 to your computer and use it in GitHub Desktop.
rails2 show sql log in console
def change_log(stream)
ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(stream)
#ActiveRecord::Base.logger = Logger.new(stream)
#ActiveRecord::Base.clear_active_connections!
end
def show_log
change_log(STDOUT)
end
def hide_log
change_log(nil)
end
show_log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment