Read more

Rails 7.1: Take care of the new production log default to standard out

Emanuel
April 15, 2024Software engineer at makandra GmbH

Starting with Rails 7.1 the production logger is set to standard out Show archive.org snapshot . For applications running with opscomplete Show archive.org snapshot ensure to keep logging to a file as before (e.g. when running bin/rails app:update).

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

It should be enough to change these lines in the config/environments/production.rb back to the implementation in Rails <7.1:

-  # Log to STDOUT by default
-  config.logger = ActiveSupport::Logger.new(STDOUT)
-    .tap  { |logger| logger.formatter = ::Logger::Formatter.new }
-    .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
+  # Use default logging formatter so that PID and timestamp are not suppressed.
+  config.log_formatter = ::Logger::Formatter.new
Posted by Emanuel to makandra dev (2024-04-15 08:04)