- # Log to STDOUT by default
- config.logger = ActiveSupport::Logger.new(STDOUT)
- .tap { |logger| logger.formatter = Logger::Formatter.new }
- .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
-
- # Prepend all log lines with the following tags.
+ # Log to STDOUT with the current request id as a default log tag.
config.log_tags = [ :request_id ]
+ config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
Rails 8.0におけるlogger
config.logger
は、Railsアプリで用いるロガーの設定です。rails new
で生成されるconfig/environments/production.rbにおいて、 8.0からこの設定について以下の変更が行われました(この変更のPRその1とPRその2)。この変更により、Kamralを用いたproduction環境ではタイムスタンプが二重に表示されなくなります。既存アプリでも、production環境でタイムスタンプが二重になっている場合には、この変更を行ってタイムスタンプが1つになるようにすると良いかもしれません。