Configure structured JSON logging
This configuration is emulating what we do in HEY.
This commit is contained in:
@@ -28,9 +28,10 @@ gem "redcarpet"
|
||||
gem "rouge"
|
||||
gem "jbuilder"
|
||||
|
||||
# Telemetry
|
||||
# Telemetry and logging
|
||||
gem "sentry-ruby"
|
||||
gem "sentry-rails"
|
||||
gem "rails_structured_logging", bc: "rails-structured-logging"
|
||||
|
||||
group :development, :test do
|
||||
gem "debug"
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
GIT
|
||||
remote: https://github.com/basecamp/rails-structured-logging
|
||||
revision: 0c2d45dd98c92156cc419e75cdad2aa903290d82
|
||||
specs:
|
||||
rails_structured_logging (0.2.0)
|
||||
json
|
||||
rails (>= 6.0.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rails/rails.git
|
||||
revision: 5520bd835e3724ffafe3f719f9aafe951567f2f3
|
||||
@@ -420,6 +428,7 @@ DEPENDENCIES
|
||||
propshaft
|
||||
puma (>= 5.0)
|
||||
rails!
|
||||
rails_structured_logging!
|
||||
redcarpet
|
||||
rouge
|
||||
rqrcode
|
||||
|
||||
@@ -50,6 +50,9 @@ Rails.application.configure do
|
||||
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
||||
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||
|
||||
# Structured JSON logging
|
||||
config.structured_logging.logger = ActiveSupport::Logger.new(STDOUT)
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [ :request_id ]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user