Padrino mongoid伐木

时间:2011-11-23 07:53:37

标签: mongodb logging mongoid padrino

如何在控制台中查看mongodb的所有查询?

Mongoid.logger = Logger.new($stdout)

无效

database.rb

host = 'localhost'
port = Mongo::Connection::DEFAULT_PORT
database_name = case Padrino.env
  when :development then 'blog_development'
  when :production  then 'blog_production'
  when :test        then 'blog_test'
end
Mongoid.logger = Logger.new($stdout)
Mongoid.database = Mongo::Connection.new(host, port).db(database_name)

1 个答案:

答案 0 :(得分:1)

试试这个:Mongoid.logger = Padrino.logger

或更好:

Mongo::Connection.new(host, 27017, :logger => Padrino.logger).db(name)