2015-10-22 34 views

回答

1

你可以自定義Mongoid日誌級別爲described in the documentation。你也可以configure it in the main Rails application

module MyApplication 
    class Application < Rails::Application 
    config.mongoid.logger = Logger.new($stdout, :warn) 
    end 
end 

如果你想重複使用相同的Rails的記錄器,只要將Rails.logger(只要確保它分配Rails.logger初始化後。

+2

這正是我在第一時間做了,但它不我用'Logger.new($ stdout,:debug)' –

+0

'Mongoid.logger = Logger.new(STDOUT)'爲我在控制檯中工作 – user1032752

+0

既不適用於我,仍然記錄到文件上導軌5 – akostadinov

相關問題