caching - How to disable activerecord cache logging in rails -


i'm trying disable logging of caching in production. have succeeded in getting sql stop logging queries, no luck caching log entries. example line in production log:

cache (0.0ms) select `merchants`.* `merchants` `merchants`.`id` = 1 limit 1 

i not want disable logging, since want logger.debug statements show in production log. using rails 3.2.1 mysql , apache. suggestions?

i silenced cache log using method suggested post linked below.

i replaced default activerecod logger wrapper filters off messages containing unwanted texts i.e. 'cache'.

first, create file inside config/initializers example active_record.rb , inside file define wrapper class , replace active record logger in code below:

# implementation of logger ignores messages containing forbidden words # here “cache” , "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 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 existing logger filtering 1 activerecord::base.logger = cachefreelogger.new(activerecord::base.logger) if rails.env.development? 

the original post extended logger not taggedloggin did not work me.

this method suggested in blog: http://heliom.ca/blog/posts/disable-rails-cache-logging


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -