Files
mozo-backend/config/initializers/action_cable.rb
T
BenClaw df04e99447 fix(action_cable): ensure logger is set for upgraded Rails app
- ActionCable::TaggedLoggerProxy crashes with NoMethodError when
  logger is nil (common in apps upgraded from older Rails)
- Add after_initialize hook to guarantee ActionCable.server.config.logger
  falls back to Rails.logger or
2026-05-17 18:49:13 +02:00

13 lines
535 B
Ruby

# frozen_string_literal: true
# Ensure ActionCable has a logger in all environments.
# In apps upgraded from older Rails versions, the logger chain
# may not propagate to ActionCable out of the box, causing:
# NoMethodError (undefined method 'info' for nil)
# in ActionCable::Connection::TaggedLoggerProxy#log
#
Rails.application.config.after_initialize do
ActionCable.server.config.logger ||= Rails.logger || ActiveSupport::Logger.new($stdout)
ActionCable.server.config.logger.level = Rails.logger&.level || Logger::INFO
end