Jonathan Rochkind wrote: > > Is there any easy way to tell Rails to keep [RoutingError, UnknownAction, > UnknownController] out of my logs? Or > put them in a different log? Or at least omit the backtrace (which is > not a useful backtrace, since it's to Rails internals and is always the > same for an UnknownAction or RoutingError). > > By the time rescue_action_in_public is called, it seems to be too late, > the thing has already been logged.
Figured it out myself looking at source in ActionController::rescue.rb . I'll put it here for the archives. In Rails 2.1 (and hopefully 2.x in general), rescue_action_in_public is called by rescue_action. rescue_action also calls log_error, after calling rescue_action_in_public. It's log_error that writes uncaught exceptions to the log as fatal, with complete backtrace. So I can override log_error, and check the class of the error. If it's not a routing type error, call super. If it is, I can not log it, log it to a different logger, log it with a different severity, whatever. -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

