Skip to content

Commit

Permalink
Only require sentry-rails if Rails is defined
Browse files Browse the repository at this point in the history
Without this non Rails app will get a warning each time they initialise.

For example, Search API has:

```
W, [2022-03-10T09:45:26.609711 #11663] WARN -- sentry: ** [Sentry] sentry-rails can't detect Rails.logger. it may be caused by misplacement of the SDK initialization code
```
  • Loading branch information
kevindew committed Apr 4, 2022
1 parent 26319e7 commit a10fceb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

- Prevent sentry-rails logger warnings when govuk_error is used with non-Rails apps

# 4.4.3

- Update prometheus exporter server to 0.0.0.0 from localhost ([#227](https://github.com/alphagov/govuk_app_config/pull/227)).
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_app_config/govuk_error.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "sentry-ruby"
require "sentry-rails"
require "sentry-rails" if defined?(Rails)
require "govuk_app_config/govuk_statsd"
require "govuk_app_config/govuk_error/configuration"
require "govuk_app_config/version"
Expand Down

0 comments on commit a10fceb

Please sign in to comment.