Disable Logging Locally Within Rails Rake Task

I run rails 2.1 and I have a rails task that imports a lot of data and
it’s bloating my development log. I’d like to disable (or reduce)
logging during this particular task, but not globally. I’ve read that
there is a logger.silence block (http://wiki.rubyonrails.org/rails/
pages/HowtoSelectivelySuppressLogging) that would do this. But within
a rake task, how do I reference the logger instance being used to call
the silence method?

Or is there another way to accomplish this?

On Jul 3, 6:48 pm, Jobu [email protected] wrote:

I run rails 2.1 and I have a rails task that imports a lot of data and
it’s bloating my development log. I’d like to disable (or reduce)
logging during this particular task, but not globally. I’ve read that
there is a logger.silence block (http://wiki.rubyonrails.org/rails/
pages/HowtoSelectivelySuppressLogging) that would do this. But within
a rake task, how do I reference the logger instance being used to call
the silence method?
Unless you’re doing something magic I would imagine it’s just
RAILS_DEFAULT_LOGGER.

Fred

On Jul 3, 2:03 pm, Frederick C. [email protected]
wrote:

Thanks, that was it. FWIW ActiveRecord::Base.logger also worked.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs