Commit 43d78a33 authored by azul's avatar azul

Log: no trace of ActionController::RoutingError

The traces of ActionController::RoutingErrors do not add any info.
Plus they do not include anything in the clean backtrace.
- which makes rails resort to the dirty backtrace for some reason.
So here we strip of the entire backtrace
to prevent them from cluttering the logs.
parent 3f0a987a
......@@ -16,3 +16,19 @@ Rails.backtrace_cleaner.add_silencer do |line|
(line !~ Rails::BacktraceCleaner::APP_DIRS_PATTERN) &&
(line !~ /^\/?(extensions|vendor\/crabgrass_plugins)/)
end
# The traces of ActionController::RoutingErrors do not add any info.
# Plus they do not include anything in the clean backtrace.
# - which makes rails resort to the dirty backtrace for some reason.
# So here we strip of the entire backtrace
# to prevent them from cluttering the logs.
class ActionDispatch::DebugExceptions
alias_method :old_log_error, :log_error
def log_error(env, wrapper)
if wrapper.exception.is_a? ActionController::RoutingError
stripped = wrapper.exception.class.new wrapper.exception.message
wrapper = wrapper.class.new env, stripped
end
old_log_error env, wrapper
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment