Skip to content

Commit

Permalink
Merge pull request #5251 from sul-dlss/normalize-logging
Browse files Browse the repository at this point in the history
Normalize logging to production.log file
  • Loading branch information
aaron-collier authored Jan 16, 2025
2 parents a5f65ec + e09b3d1 commit 36f5fc0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
# Skip http-to-https redirect for the default health check endpoint.
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }

# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new($stdout)
.tap { |logger| logger.formatter = Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
# Log to STDOUT if env var is set
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
Expand Down

0 comments on commit 36f5fc0

Please sign in to comment.