-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Rails7.1 #23522
Comments
I've run into the same problem |
We're running into this same issue when trying to access |
I have an error that looks like when launching Sidekiq: undefined method `broadcast' for ActiveSupport::Logger:Class
/usr/local/bundle/ruby/3.2.0/gems/sidekiq-7.2.1/lib/sidekiq/rails.rb:62:in `block (2 levels) in <class:Rails>'
/usr/local/bundle/ruby/3.2.0/gems/sidekiq-7.2.1/lib/sidekiq.rb:98:in `configure_server'
/usr/local/bundle/ruby/3.2.0/gems/sidekiq-7.2.1/lib/sidekiq/rails.rb:53:in `block in <class:Rails>' My stack :
It's very strange because i have only this error in RAILS_ENV=production, not in RAILS_ENV=staging |
We are also experiencing the same problem! |
I've solved this by replacing Rails.logger with a BroadcastLogger to the same logger. It's easy to add into your Rails app: just put this straight after the app is initialized =) unless Rails.logger.respond_to?(:broadcast_to)
Rails.logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
end e.g. in config/environment.rb # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
# Rails.logger is a Google::Cloud::Logging::Logger, which does not have `broadcast_to` so
# we have to patch it in to allow activerecord/railtie to not error when opening a rails console. Thankfully we can
# just make Rails.logger a BroadcastLogger.
#
# See https://github.com/rails/rails/blob/v7.1.3/activerecord/lib/active_record/railtie.rb#L70
unless Rails.logger.respond_to?(:broadcast_to)
Rails.logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
end |
We see the same error in production with our Sidekiq workers. There is no issue when using the Rails console. Our stack is:
|
Environment details
Steps to reproduce
Google::Cloud::Logging::Logger#broadcast_to
has to be implemented on sidekiq startup process when we use it after Rails 7.1 as hereWorkaround
We changed use_logging as false, then deploy was succeeded. But we also lost informations of LogSeverity and request trace data on Cloud Logging, so I think it's desirable to set
use_logging: true
as default.Code
Full backtrace
The text was updated successfully, but these errors were encountered: