stop a request from appearing in the logs

4 views
Skip to first unread message

nahum

unread,
Oct 10, 2011, 9:28:25 PM10/10/11
to wellr...@googlegroups.com
we have a url that HAProxy hits to confirm each app instance is up. this tends to fill up our logs - anyone know of a simple way to stop an action from logging at all?

cheers,
nahum

Warren Seen

unread,
Oct 10, 2011, 9:52:04 PM10/10/11
to wellr...@googlegroups.com
Would this work? http://dennisreimann.de/blog/silencing-the-rails-log-on-a-per-action-basis/

(I'd also investigate whether you could implement this endpoint as a rack middleware, or using Metal (if you're on Rails 3) if you don't need the full stack, as I don't think requests to rack middleware get logged?)


--
You received this message because you are subscribed to the Google Groups "WellRailed" group.
To view this discussion on the web visit https://groups.google.com/d/msg/wellrailed/-/E3fRuSu0PiIJ.
To post to this group, send email to wellr...@googlegroups.com.
To unsubscribe from this group, send email to wellrailed+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wellrailed?hl=en.

Will Bryant

unread,
Oct 10, 2011, 9:56:44 PM10/10/11
to wellr...@googlegroups.com
We use metal.  It's faster too - less CPU wasted going through the stack when we don't need to.


Y. Thong Kuah

unread,
Oct 10, 2011, 9:57:06 PM10/10/11
to wellr...@googlegroups.com
with Rails 3, it should be as simple as inheriting from ActionController::Metal and re-adding modules as you need it.

with Rails 2, just using metal should preclude logging.

--
You received this message because you are subscribed to the Google Groups "WellRailed" group.
To view this discussion on the web visit https://groups.google.com/d/msg/wellrailed/-/E3fRuSu0PiIJ.
To post to this group, send email to wellr...@googlegroups.com.
To unsubscribe from this group, send email to wellrailed+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wellrailed?hl=en.



--
Best regards,
Y. Thong Kuah


Phil Calder

unread,
Oct 10, 2011, 9:58:49 PM10/10/11
to wellr...@googlegroups.com
In your controller:

def logger
  unless params['action'] == 'monitor'
    RAILS_DEFAULT_LOGGER
  end
end

If your app controller / authentication etc does any logging (via a before_filter) this will have to be silenced too.
--
----------------------------------------
Phil Calder
philc...@gmail.com
----------------------------------------

nahum

unread,
Oct 11, 2011, 1:47:38 AM10/11/11
to wellr...@googlegroups.com
Thanks for all the quick replies!

As always the simple solution of using Metal I think is spot on, rather than trying to override logging etc....


--nahum
Reply all
Reply to author
Forward
0 new messages