Reputation: 2072
When using ActiveRecord one can see all SQL queries executed when page is being loaded. How to achieve the same with Mongoid 5?
Upvotes: 5
Views: 4543
Reputation: 176352
You can customize Mongoid logging level as described in the documentation. You can also configure it in the main Rails application.
module MyApplication
class Application < Rails::Application
config.mongoid.logger = Logger.new($stdout, :warn)
end
end
If you want to reuse the same Rails logger, simply assign Rails.logger
(just make sure to assign it after the Rails.logger
is initialized.
Upvotes: 5