reidmorrison/rails_semantic_logger

undefined method `broadcast` for class `ActiveSupport::Logger` on rails 7.1.0

joshRpowell opened this issue · 3 comments

module ActiveSupport
# More hacks to try and stop Rails from being it's own worst enemy.
class Logger
class << self
undef :logger_outputs_to?, :broadcast
end

see new public API for broadcasting logs https://github.com/rails/rails/releases/tag/v7.1.0.rc1

full trace

/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/extensions/active_support/logger.rb:7:in `singleton class': undefined method `broadcast' for class `ActiveSupport::Logger' (NameError)
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/extensions/active_support/logger.rb:6:in `<class:Logger>'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/extensions/active_support/logger.rb:5:in `<module:ActiveSupport>'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/extensions/active_support/logger.rb:3:in `<main>'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger.rb:60:in `<main>'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/runtime.rb:55:in `each'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/runtime.rb:55:in `block in require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/runtime.rb:44:in `each'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/runtime.rb:44:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler.rb:187:in `require'
from /config/application.rb:7:in `<main>'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command/actions.rb:15:in `require_application!'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command/environment_argument.rb:31:in `require_application!'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command/actions.rb:19:in `boot_application!'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/commands/console/console_command.rb:105:in `perform'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command/base.rb:178:in `invoke_command'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command/base.rb:73:in `perform'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command.rb:71:in `block in invoke'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command.rb:149:in `with_argv'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/command.rb:69:in `invoke'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/commands.rb:18:in `<main>'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from bin/rails:10:in `<main>'

same problem in rails 7.1.0 ( not rc )

rails_semantic_logger v 4.13.0 has been published and includes several community contributions to get it working with Rails 7.1. Please try the new version and open a new issue if the problem persists.