Moudy
Moudy

Reputation: 888

How do you log Mongo queries using Grape?

I'm building an API using Grape and using mongoid as an ORM for MongoDB. I tried starting the app with foreman, shotgun and rackup and none of them display the mongo queries that Mongoid is making. I'm setting the logger according to their documentation. How can see these queries?

Mongoid.logger = App.logger
Mongoid.logger.level = Logger::INFO

Upvotes: 0

Views: 449

Answers (1)

Moudy
Moudy

Reputation: 888

Turns out I needed to set the Moped logger and level as well.

Mongoid.logger = Moped.logger = App.logger
Mongoid.logger.level = Moped.logger.level = Logger::DEBUG

Upvotes: 2

Related Questions