From d0fabd105b33af5d36ea2375a2573982899d3137 Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Tue, 3 Dec 2024 16:34:35 -0500 Subject: [PATCH] Add RAILS_LOG_TO_STDOUT support --- config/environments/production.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 667077204..d5499a8c8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -19,7 +19,13 @@ # Use a different logger for distributed setups # config.logger = SyslogLogger.new # STDOUT used for Tomcat/catalina.out logging - config.logger = ActiveSupport::Logger.new("#{Rails.root}/log/production.log") + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + else + config.logger = ActiveSupport::Logger.new("#{Rails.root}/log/production.log") + end # Use a different cache store in production # config.cache_store = :mem_cache_store