Suppressing log messages for an action


#1

Hi all,

I have a rails app that regularly pings the server to check for
changes. The problem I’m having is that my “ping” action is printing
so much output to the log that it’s swamping any useful data. Is there
a way to turn off the log for a specific action? Ideally I’d like it
to print to the log only if there’s an error, but I’d be quite happy
to just turn off the log altogether for the ping action. I’m using the
default Rails logger.

Many thanks,
Adam


#2

Have you looked at BufferedLogger#silence?

http://apidock.com/rails/ActiveSupport/BufferedLogger/silence

Adam wrote:

Hi all,

I have a rails app that regularly pings the server to check for
changes. The problem I’m having is that my “ping” action is printing
so much output to the log that it’s swamping any useful data. Is there
a way to turn off the log for a specific action? Ideally I’d like it
to print to the log only if there’s an error, but I’d be quite happy
to just turn off the log altogether for the ping action. I’m using the
default Rails logger.

Many thanks,
Adam