以下にリンクされている投稿で提案されている方法を使用して、CACHE ログを沈黙させました。
デフォルトの ActiveRecod ロガーを、「CACHE」などの不要なテキストを含むメッセージをフィルター処理するラッパーに置き換えました。
まず、config/initializers
たとえば内部にファイルを作成し、そのファイル内でactive_record.rb
ラッパー クラスを定義して、以下のコードのようにアクティブなレコード ロガーを置き換えます。
# Implementation of logger that ignores messages containing forbidden words
# here “CACHE” and "Settings Load"
class CacheFreeLogger < ActiveSupport::TaggedLogging
@@excluded = ['Settings Load','CACHE']
def add(severity, message = nil, progname = nil, &block)
if message.nil?
if block_given?
message = block.call
else
message = progname
progname = nil #No instance variable for this like Logger
end
end
if severity > Logger::DEBUG || !(@@excluded.map{|e| message.include? e}.include?(true))
@logger.add(severity, "#{tags_text}#{message}", progname)
end
end
end
#Replace the existing logger with the filtering one
ActiveRecord::Base.logger = CacheFreeLogger.new(ActiveRecord::Base.logger) if Rails.env.development?
元の投稿では TaggedLoggin ではなく Logger を拡張していましたが、うまくいきませんでした。
この方法はブログで提案されました: http://heliom.ca/blog/posts/disable-rails-cache-logging