From bfd0e7f78491ab59ad5df85f8046809a89df3325 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Tue, 30 Jul 2024 11:38:46 +1000 Subject: [PATCH] Add request_id to logs for production and staging It will prepend a request unique id to each log lines, it makes it easier to debug individual request. --- config/environments/production.rb | 1 + config/environments/staging.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index d6877e67e91..727598011ce 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -40,6 +40,7 @@ # Configure logging: config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } + config.log_tags = [:request_id] # Use a different cache store in production config.cache_store = :redis_cache_store, { diff --git a/config/environments/staging.rb b/config/environments/staging.rb index d6877e67e91..727598011ce 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -40,6 +40,7 @@ # Configure logging: config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } + config.log_tags = [:request_id] # Use a different cache store in production config.cache_store = :redis_cache_store, {