How do I turn on SQL debug logging for ActiveRecord in RSpec tests? How do I turn on SQL debug logging for ActiveRecord in RSpec tests? ruby ruby

How do I turn on SQL debug logging for ActiveRecord in RSpec tests?


You could try setting the ActiveRecord logger to stdout in your test somewhere. If you're using rspec, maybe in the spec helper?

ActiveRecord::Base.logger = Logger.new(STDOUT)


By default, all your db queries will be logged already in test mode. They'll be in log/test.log.


set

config.log_level = :info 

in test environment