Skip to content

Commit

Permalink
Restore formatting to log output on production!
Browse files Browse the repository at this point in the history
A config change in Rails 7.1.2 moves where you apply the default formatter to log output.

We do want timestamp and PID in our logging... not having it flatlined our MRTG logging for the last 24+ hours, too.
  • Loading branch information
nimmolo committed Jan 13, 2024
1 parent 87def91 commit 7b7077b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@
# .tap { |logger| logger.formatter = ::Logger::Formatter.new }
# .then { |logger| ActiveSupport::TaggedLogging.new(logger) }

# Log to STDOUT and production.log. New 7.1 logging uses BroadcastLogger
# Not using TaggedLogging yet.
loggers = [
STDOUT,
"log/production.log"
].map do |output|
ActiveSupport::Logger.new(output).
tap { |logger| logger.formatter = Logger::Formatter.new }
# .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
end
config.logger = ActiveSupport::BroadcastLogger.new(*loggers)

# Prepend all log lines with the following tags.
# config.log_tags = [ :request_id, :subdomain, :uuid ]

Expand Down

0 comments on commit 7b7077b

Please sign in to comment.