I need to run some info/debug logging in production environment to find a very elusive problem. However, I have load balancers which whack a very simple request very frequently to ensure the entire app stack is active. I have a controller with one action dedicated to this monitoring task. I would really like to stop that entire request from being logged to eliminate the massive amount of noise it generates with info & debug messages. So something in the header of the controller would seem appropriate if possible. I''ve seen several questions like mine, but no solid answers. I''ve tried the suggestions found here to no avail. http://www.ruby-forum.com/topic/163669 http://www.ruby-forum.com/topic/82141 Any new thoughts? -- gw -- Posted via http://www.ruby-forum.com/.
On Mon, Sep 28, 2009 at 7:22 PM, Greg Willits < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I need to run some info/debug logging in production environment to find > a very elusive problem. > > However, I have load balancers which whack a very simple request very > frequently to ensure the entire app stack is active. I have a controller > with one action dedicated to this monitoring task. > > I would really like to stop that entire request from being logged to > eliminate the massive amount of noise it generates with info & debug > messages. So something in the header of the controller would seem > appropriate if possible. > > I''ve seen several questions like mine, but no solid answers. I''ve tried > the suggestions found here to no avail. > > http://www.ruby-forum.com/topic/163669 > http://www.ruby-forum.com/topic/82141 > > Any new thoughts? > > -- gw >The way I do it: class PulseController def logger end def index # render some text if you want a monitor of some sort end end then route whatever your load balancer hits to this controller and you''re good. Jason --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Roelofs wrote:> On Mon, Sep 28, 2009 at 7:22 PM, Greg Willits < > class PulseController > def logger > endHeh, that''s brute force but simple :-) It supresses messages from the controller alright, but doesn''t supress the database query as part of that action''s chores (doing a mysql ping as part of the stack check). But I could possibly tinker further. -- gw -- Posted via http://www.ruby-forum.com/.
On Sep 28, 2009, at 5:16 PM, Greg Willits wrote:> > Jason Roelofs wrote: >> On Mon, Sep 28, 2009 at 7:22 PM, Greg Willits < >> class PulseController >> def logger >> end > > Heh, that''s brute force but simple :-) It supresses messages from the > controller alright, but doesn''t supress the database query as part of > that action''s chores (doing a mysql ping as part of the stack check). > > But I could possibly tinker further.I''m coming in late so maybe this has mentioned... def my_action ActiveRecord::Base.silence do ..... nothing AR related will show up in the logs.... end end Search the rails source for "silence" to make sure I''ve got that down right.
Philip Hallstrom wrote:> On Sep 28, 2009, at 5:16 PM, Greg Willits wrote: > >> >> But I could possibly tinker further. > > I''m coming in late so maybe this has mentioned... > > def my_action > ActiveRecord::Base.silence do > ..... nothing AR related will show up in the logs.... > end > end > > Search the rails source for "silence" to make sure I''ve got that down > right.Hmm, logical but nope. Still getting queries logged, but that may be because I used this technique to add timestamps and log level info to the log output. Maybe there''s interference. (how could anyone think timestamps would not be useful in a log ????????). http://nopugs.com/2008/07/10/how-to-get-timestamps-in-your-ruby-on-rails-logs I''ll fiddle more. -- gw -- Posted via http://www.ruby-forum.com/.
How about up''ing the logger level temporarily, like ... bak_log_level = logger.level begin logger.level = Logger::ERROR # do some stuff ... ... ensure logger.level = bak_log_level end ... Jeff On Sep 28, 5:38 pm, Greg Willits <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Philip Hallstrom wrote: > > On Sep 28, 2009, at 5:16 PM, Greg Willits wrote: > > >> But I could possibly tinker further. > > > I''m coming in late so maybe this has mentioned... > > > def my_action > > ActiveRecord::Base.silence do > > ..... nothing AR related will show up in the logs.... > > end > > end > > > Search the rails source for "silence" to make sure I''ve got that down > > right. > > Hmm, logical but nope. Still getting queries logged, but that may be > because I used this technique to add timestamps and log level info to > the log output. Maybe there''s interference. (how could anyone think > timestamps would not be useful in a log ????????). > > http://nopugs.com/2008/07/10/how-to-get-timestamps-in-your-ruby-on-ra... > > I''ll fiddle more. > > -- gw > -- > Posted viahttp://www.ruby-forum.com/.