From 766c3a8858d5c8f456fb410f36b6ff3c497d6c1e Mon Sep 17 00:00:00 2001 From: Sean Rankine Date: Wed, 17 Jul 2019 09:42:03 +0100 Subject: [PATCH 1/2] Use debug level for logger when forwarding headers This changes the existing logging at info level to debug level to prevent noisy logging. --- CHANGELOG.md | 1 + lib/gds_api/railtie.rb | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04dd0c0e..c0042d19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Adds middleware to allow the header `X-Govuk-Authenticated-User-Organisation` to be passed along to content-store. +* Changes logging level about header forwarding from info to debug # 59.5.1 diff --git a/lib/gds_api/railtie.rb b/lib/gds_api/railtie.rb index 9a2a26d6..56b41131 100644 --- a/lib/gds_api/railtie.rb +++ b/lib/gds_api/railtie.rb @@ -3,27 +3,27 @@ module GdsApi class Railtie < Rails::Railtie initializer "gds_api.initialize_govuk_request_id_sniffer" do |app| - Rails.logger.info "Using middleware GdsApi::GovukHeaderSniffer to sniff for GOVUK-Request-Id header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for GOVUK-Request-Id header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_GOVUK_REQUEST_ID' end initializer "gds_api.initialize_govuk_original_url_sniffer" do |app| - Rails.logger.info "Using middleware GdsApi::GovukHeaderSniffer to sniff for GOVUK-Original-Url header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for GOVUK-Original-Url header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_GOVUK_ORIGINAL_URL' end initializer "gds_api.initialize_govuk_authenticated_user_sniffer" do |app| - Rails.logger.info "Using middleware GdsApi::GovukHeaderSniffer to sniff for X-Govuk-Authenticated-User header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for X-Govuk-Authenticated-User header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_X_GOVUK_AUTHENTICATED_USER' end initializer "gds_api.initialize_govuk_authenticated_user_organisation_sniffer" do |app| - Rails.logger.info "Using middleware GdsApi::GovukHeaderSniffer to sniff for X-Govuk-Authenticated-User-Organisation header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for X-Govuk-Authenticated-User-Organisation header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_X_GOVUK_AUTHENTICATED_USER_ORGANISATION' end initializer "gds_api.initialize_govuk_content_id_sniffer" do |app| - Rails.logger.info "Using middleware GdsApi::GovukHeaderSniffer to sniff for Govuk-Auth-Bypass-Id header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for Govuk-Auth-Bypass-Id header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_GOVUK_AUTH_BYPASS_ID' end end From 76fb78f00f7a109698cd365ef0985e26ddcf5bcb Mon Sep 17 00:00:00 2001 From: Sean Rankine Date: Thu, 18 Jul 2019 11:43:59 +0100 Subject: [PATCH 2/2] Change casing of header names in debug messages This fixes the cases of references to the Govuk-X headers in the debug messages. --- lib/gds_api/railtie.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gds_api/railtie.rb b/lib/gds_api/railtie.rb index 56b41131..89d56a2c 100644 --- a/lib/gds_api/railtie.rb +++ b/lib/gds_api/railtie.rb @@ -3,12 +3,12 @@ module GdsApi class Railtie < Rails::Railtie initializer "gds_api.initialize_govuk_request_id_sniffer" do |app| - Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for GOVUK-Request-Id header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for Govuk-Request-Id header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_GOVUK_REQUEST_ID' end initializer "gds_api.initialize_govuk_original_url_sniffer" do |app| - Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for GOVUK-Original-Url header" + Rails.logger.debug "Using middleware GdsApi::GovukHeaderSniffer to sniff for Govuk-Original-Url header" app.middleware.use GdsApi::GovukHeaderSniffer, 'HTTP_GOVUK_ORIGINAL_URL' end