Skip to content

Commit

Permalink
GovukAppConfig silences OpenTelemetry log output when running a rake …
Browse files Browse the repository at this point in the history
…task
  • Loading branch information
KludgeKML committed Aug 17, 2023
1 parent 8d4a43a commit 898b207
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

* GovukAppConfig silences OpenTelemetry log output when running a rake task ([#311](https://github.com/alphagov/govuk_app_config/pull/311))

# 9.0.4

* Fix an issue with Rails.logger being not an instance of ActiveSupport::Logger. Rails expects Rails.logger to have methods that Ruby STD Logger does not provide. e.g. `silence()` ([#309](https://github.com/alphagov/govuk_app_config/pull/309))
Expand Down Expand Up @@ -36,7 +40,7 @@

# 8.0.1

* Change the "source" field in Rails logs from logstasher from string representing IP host address to an empty object.
* Change the "source" field in Rails logs from logstasher from string representing IP host address to an empty object.

# 8.0.0

Expand Down
5 changes: 5 additions & 0 deletions lib/govuk_app_config/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class Railtie < Rails::Railtie
initializer "govuk_app_config.configure_open_telemetry" do |app|
unless Rails.const_defined?(:Console)
GovukOpenTelemetry.configure(app.class.module_parent_name.underscore)
if Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.any?
OpenTelemetry::SDK.configure do |c|
c.logger = Logger.new(File::NULL)
end
end
end
end

Expand Down

0 comments on commit 898b207

Please sign in to comment.