Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1812] Stop okcomputer logging #1088

Merged
merged 4 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,7 @@ group :test do
gem "vcr", "~> 6.2"
gem "webmock", "~> 3.18"
end

group :production do
gem "rails_semantic_logger"
end
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails_semantic_logger (4.14.0)
rack
railties (>= 5.1)
semantic_logger (~> 4.13)
railties (7.1.3.1)
actionpack (= 7.1.3.1)
activesupport (= 7.1.3.1)
Expand Down Expand Up @@ -435,6 +439,8 @@ GEM
rexml
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
semantic_logger (4.15.0)
concurrent-ruby (~> 1.0)
sentry-rails (5.10.0)
railties (>= 5.0)
sentry-ruby (~> 5.10.0)
Expand Down Expand Up @@ -580,6 +586,7 @@ DEPENDENCIES
rack-attack
rails (~> 7.1.3)
rails-erd
rails_semantic_logger
rladr (~> 1.2)
rspec
rspec-rails
Expand Down
5 changes: 5 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@
config.action_mailer.notify_settings = {
api_key: ENV.fetch("GOVUK_NOTIFY_API_KEY"),
}

config.log_level = :info # Or :warn, or :error
config.log_format = :json # For parsing in Logit
config.rails_semantic_logger.add_file_appender = false # Don't log to file
config.active_record.logger = nil # Don't log SQL
end
1 change: 0 additions & 1 deletion config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require_relative "../../lib/ok_computer_checks/zendesk_check"
require_relative "../../lib/ok_computer_checks/notify_check"

OkComputer.logger = Rails.logger
OkComputer.mount_at = "health"

OkComputer::Registry.register "postgresql", OkComputer::ActiveRecordCheck.new
Expand Down
10 changes: 10 additions & 0 deletions config/initializers/semantic_logger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
return unless defined?(SemanticLogger)

Rails.application.configure do
config.semantic_logger.application = "" # This is added by logstash from its tags
config.log_tags = [:request_id] # Prepend all log lines with the following tags
end

SemanticLogger.add_appender(io: $stdout, level: Rails.application.config.log_level,
formatter: Rails.application.config.log_format)
Rails.application.config.logger.info('Application logging to STDOUT')
Loading