Blog of Raivo Laanemets

Get rid of RoutingError from Redmine log

On

Non-existing routes will cause errors like:

ActionController::RoutingError (No route matches [GET] "/redmine/something")

with an heavy stack trace in the production.log. This can make real errors go unnoticed. You will get lots and lots of these errors when you archive a project that was public before. The fix is a monkey patch:

class ActionDispatch::DebugExceptions
    alias_method :old_log_error, :log_error
    def log_error(env, wrapper)
        if wrapper.exception.is_a?  ActionController::RoutingError
            return
        else
            old_log_error env, wrapper
        end
    end
end

I put this at the end of config/initializers/30-redmine.rb.

The original solution is from StackOverflow: Stop logging ActionController::RoutingError Rails 3.2.


Comments

No comments have been added so far.

Email is not displayed anywhere.
URLs (max 3) starting with http:// or https:// can be used. Use @Name to mention someone.