Skip to content

Commit

Permalink
Merge pull request #80 from FundingCircle/disable_action_dispatch_deb…
Browse files Browse the repository at this point in the history
…ug_exceptions

Disable ActionDispatch::DebugExceptions
  • Loading branch information
timstott authored Sep 7, 2016
2 parents f9fd37d + 5f59aa7 commit a1b284d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/loga/ext/rails/rack/debug_exceptions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module ActionDispatch
class DebugExceptions
private

def logger(_request)
end
end
end
5 changes: 5 additions & 0 deletions lib/loga/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def call
insert_loga_rack_logger
disable_rails_rack_logger
insert_exceptions_catcher
disable_action_dispatch_debug_exceptions
end

private
Expand All @@ -88,6 +89,10 @@ def disable_rails_rack_logger
end
end

def disable_action_dispatch_debug_exceptions
require 'loga/ext/rails/rack/debug_exceptions.rb'
end

def insert_loga_rack_logger
app.middleware.insert_after Rails::Rack::Logger,
Loga::Rack::Logger,
Expand Down
2 changes: 1 addition & 1 deletion lib/loga/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Loga
VERSION = '1.2.1'.freeze
VERSION = '1.3.0'.freeze
end
8 changes: 8 additions & 0 deletions spec/integration/rails/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@
expect(action_view_notifications).to be_empty
end
end

describe 'when request causes ActionDispatch 404' do
it 'does not log ActionDispatch::DebugExceptions' do
get '/not_found', {}, 'HTTP_X_REQUEST_ID' => '471a34dc'
expect(json_entries.count).to eq(1)
expect(json['short_message']).to eq('GET /not_found 404 in 0ms')
end
end
end

0 comments on commit a1b284d

Please sign in to comment.