Is there a way to disable SQL query logging when I'm executing commands in the console? Ideally, it would be great if I can just disable it and re-enable it with a command in the console.
I'm trying to debug something and using "puts" to print out some relevant data. However, the sql query output is making it hard to read.
Edit: I found another solution, since setting the logger to nil sometimes raised an error, if something other than my code tried to call logger.warn
Instead of setting the logger to nil
you can set the level of the logger to 1
.
ActiveRecord::Base.logger.level = 1 # or Logger::INFO
since setting the logger to nil sometimes raised an error
yap.. I got this one when trying to runrake db:migrate
#1719712 – Lil