Sunday, August 25, 2013

Rails - disable sql logging (to not show in "rails server" terminal)

"rails server" log, to become useful, should not have sql lines showing up in between "rendered", "redirected", "Start GET", "Processing by" lines (which are very important at the time of development).

http://stackoverflow.com/questions/7759321/disable-rails-3-1-sql-logging
To turn it off:
old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
To turn it back on:
ActiveRecord::Base.logger = old_logger
(We can do the above in "rails console")

No comments:

Post a Comment

Followers

Blog Archive