Ruby on Rails
HowtoSelectivelySuppressLogging

Grabbed from the mailing list

Question: Is there any way to turn off some log entries but leave all the other actions log levels unchanged?

Jamis Buck’s reply:

You can do the following:


  def monitor
    logger.silence do
      ...
    end
  end

The #silence method is a Rails addition to logger that temporarily bumps the log level up to ERROR for the duration of the block. If you want it to be a little more verbose than that, you can also specify the log level explicitly:


  logger.silence(Logger::WARN) do
    ...
  end

category: Howto