LoginSignup
8
8

More than 5 years have passed since last update.

activerecord-importのLoggerを黙らせる

Last updated at Posted at 2014-11-14

activerecord-import gemを使っています。
大量データをbulk insertしても一瞬で終わるのでとても快適です。
しかし、logを見ると、大量なinsert文が吐かれています。

その他のActiveRecordログは時々確認したいですが、importログは見たくないです。
ネットでググると、ActiveRecordのLogger Levelを一時的に変えるなどの記事がありましたが、これが一番素敵です。

  ActiveRecord::Base.logger.silence do
    SomeModel.import a_lot_of_data
  end
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8