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 money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
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)