reidmorrison/rails_semantic_logger

Error when upgrading Rails from 7.0 to 7.1: ArgumentError: comparison of Symbol with 0 failed (ArgumentError)

fguillen opened this issue · 3 comments

Environment

Provide at least:

  • Ruby Version.
> ruby -v
ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-darwin22]
  • Rails Version.
> bin/rails -v
Rails 7.1.0
  • Semantic Logger Version.
> bundle info semantic_logger --version 
4.15.0
  • Rails Semantic Logger Version.
> bundle info rails_semantic_logger --version
4.14.0
  • Full Stack Trace, if an exception is being raised.

Error when running bin/rails app:update

       exist  bin
   identical  bin/rails
   identical  bin/rake
   identical  bin/setup
       rails  active_storage:update
bin/rails aborted!
ArgumentError: comparison of Symbol with 0 failed (ArgumentError)

      logger.nil? || logger.level > @event_levels.fetch(event, Float::INFINITY)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/me/Development/PlaycocolaBackend/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => active_storage:update => environment
(See full trace by running task with --trace)

It's also happening when running tests:

> bin/rails test
/Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/log_subscriber.rb:140:in `>': comparison of Symbol with 0 failed (ArgumentError)

      logger.nil? || logger.level > @event_levels.fetch(event, Float::INFINITY)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/log_subscriber.rb:140:in `silenced?'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/notifications/fanout.rb:403:in `silenced?'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/notifications/fanout.rb:305:in `block in listeners_for'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/notifications/fanout.rb:305:in `reject'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/notifications/fanout.rb:305:in `listeners_for'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger.rb:46:in `block in unattach'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger.rb:45:in `each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger.rb:45:in `unattach'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger.rb:39:in `block in swap_subscriber'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger.rb:39:in `each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger.rb:39:in `swap_subscriber'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.14.0/lib/rails_semantic_logger/engine.rb:177:in `block in <class:Engine>'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/lazy_load_hooks.rb:94:in `block in execute_hook'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/lazy_load_hooks.rb:77:in `each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/application/finisher.rb:93:in `block in <module:Finisher>'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/initializable.rb:32:in `run'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:347:in `each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:347:in `call'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/application.rb:423:in `initialize!'
	from /Users/me/Development/PlaycocolaBackend/config/environment.rb:5:in `<top (required)>'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/me/Development/PlaycocolaBackend/test/test_helper.rb:8:in `<top (required)>'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/me/Development/PlaycocolaBackend/test/controllers/admin/admin_authorizations_controller_test.rb:1:in `<top (required)>'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/test_unit/runner.rb:51:in `block in load_tests'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/test_unit/runner.rb:51:in `each'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/test_unit/runner.rb:51:in `load_tests'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/test_unit/runner.rb:43:in `run'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/commands/test/test_command.rb:33:in `perform'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/command/base.rb:178:in `invoke_command'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/command/base.rb:73:in `perform'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/command.rb:71:in `block in invoke'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/command.rb:149:in `with_argv'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/command.rb:69:in `invoke'
	from /Users/me/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/commands.rb:18:in `<top (required)>'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/me/.rbenv/versions/3.2.4/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from bin/rails:4:in `<main>'

The error is not happening in Rails 7.1.3.3 :)