views:

22

answers:

2

Is it possible to filter out DB queries that hit Rails' query cache from Rails logs? The presence of these "queries" makes it harder to debug performance issues

+1  A: 

I was going to ask this question a few weeks ago, but then didn't get round to it. I'm not sure what the best way to do this is, but I'd think doing something like

ActiveRecord::Base.logger = QuietLogger.new

class QuietLogger < Logger
  def add(severity, message = nil, progname = nil, &block)
    super unless message ~= /CACHE/
  end
end

I haven't tested this, but what you'd need to do is override the add method on the Logger and check for messages that contain CACHE. Hopefully I'm not that far off!

jonnii
A: 

I recommend request-log-analyzer for analyzing rails performance from logs.

KARASZI István