Does anyone know what the best way to disable logging on a controller or specific action? I''ve seen a lot of threads, but no real "best practice"? Thanks, Tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
TomRossi7 wrote:> Does anyone know what the best way to disable logging on a controller > or specific action? I''ve seen a lot of threads, but no real "best > practice"? >Why would you ever want to do this? An inaccurate log is worse than none at all. What''s your use case?> Thanks, > TomBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I have an action being called by a monitoring service. Leaving this out of the log is not "inaccurate", anymore than not logging static files referenced is the public folder is "inaccurate". Thanks, Tom On Apr 27, 2:43 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> TomRossi7 wrote: > > Does anyone know what the best way to disable logging on a controller > > or specific action? I''ve seen a lot of threads, but no real "best > > practice"? > > Why would you ever want to do this? An inaccurate log is worse than > none at all. > > What''s your use case? > > > Thanks, > > Tom > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
TomRossi7 wrote:> I have an action being called by a monitoring service. > > Leaving this out of the log is not "inaccurate",I''m not sure I agree. The log tells you what Rails has been up to. One of the things it has been up to is servicing the requests that come from the monitoring service. Leaving those requests out of the log will lessen the utility of the log. Consider: if there were a bug or bottleneck in the monitoring request, how would you know? If the monitoring service weren''t requesting its action, how would you know? Picking and choosing in the log is a bad idea.> anymore than not > logging static files referenced is the public folder is "inaccurate".The analogy doesn''t hold. The log is specifically a Rails log. Files in /public aren''t served by Rails; therefore, they don''t appear in the log. Your monitoring requests, however, are served by Rails and should appear in the log.> > Thanks, > TomBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen, I do appreciate the feedback, but I wonder if others agree? Maybe that is why its not a simple task within Rails? Anyone? Thanks, Tom On Apr 27, 5:08 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> TomRossi7 wrote: > > I have an action being called by a monitoring service. > > > Leaving this out of the log is not "inaccurate", > > I''m not sure I agree. The log tells you what Rails has been up to. One > of the things it has been up to is servicing the requests that come from > the monitoring service. Leaving those requests out of the log will > lessen the utility of the log. > > Consider: if there were a bug or bottleneck in the monitoring request, > how would you know? If the monitoring service weren''t requesting its > action, how would you know? > > Picking and choosing in the log is a bad idea. > > > anymore than not > > logging static files referenced is the public folder is "inaccurate". > > The analogy doesn''t hold. The log is specifically a Rails log. Files > in /public aren''t served by Rails; therefore, they don''t appear in the > log. Your monitoring requests, however, are served by Rails and should > appear in the log. > > > > > Thanks, > > Tom > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Apr 27, 2010 at 3:49 PM, TomRossi7 <tom-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> I do appreciate the feedback, but I wonder if others agree? Maybe > that is why its not a simple task within Rails?I think logging is a tool, and what you choose to record is up to you. That said, I have no idea how to selectively turn off the standard Rails logging. :-) I was able to get rid of the usual "Processing blah blah..." message with e.g. def index logger.auto_flushing= 0 @things = Thing.all logger.send("clear_buffer") logger.auto_flushing= 1000 end but the "Rendering template blah blah... " still shows up. Maybe that''ll give you some ideas. Sounds like a good idea for a gem, if selective (or more configurable) logging isn''t part of Rails 3. I haven''t looked. FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Tom, Not sure if it applies to your specific case, but whenever I come across the need to quiet the logging activity for some particular verbose-under-normal-logging activity process that I''m really only concerned about logging-wise only if it fails, ... I usually just temporarily up the log-level for the specific handling of that process. Something like: # in the controller: ... bak_log_level = logger.level begin logger.level = Logger::ERROR # do some stuff ... ... ensure logger.level = bak_log_level end ... Jeff On Apr 27, 3:49 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> Marnen, > > I do appreciate the feedback, but I wonder if others agree? Maybe > that is why its not a simple task within Rails? > > Anyone? > > Thanks, > Tom > > On Apr 27, 5:08 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > > > > > > TomRossi7 wrote: > > > I have an action being called by a monitoring service. > > > > Leaving this out of the log is not "inaccurate", > > > I''m not sure I agree. The log tells you what Rails has been up to. One > > of the things it has been up to is servicing the requests that come from > > the monitoring service. Leaving those requests out of the log will > > lessen the utility of the log. > > > Consider: if there were a bug or bottleneck in the monitoring request, > > how would you know? If the monitoring service weren''t requesting its > > action, how would you know? > > > Picking and choosing in the log is a bad idea. > > > > anymore than not > > > logging static files referenced is the public folder is "inaccurate". > > > The analogy doesn''t hold. The log is specifically a Rails log. Files > > in /public aren''t served by Rails; therefore, they don''t appear in the > > log. Your monitoring requests, however, are served by Rails and should > > appear in the log. > > > > Thanks, > > > Tom > > > Best, > > -- > > Marnen Laibow-Koserhttp://www.marnen.org > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > > Posted viahttp://www.ruby-forum.com/. > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.