Skip to content

Ensure the logger gem is loaded in Rails 7.0#54264

Merged
fatkodima merged 1 commit intorails:7-0-stablefrom
mainio:fix/7-0-logger-uninitialized-constant
Jan 16, 2025
Merged

Ensure the logger gem is loaded in Rails 7.0#54264
fatkodima merged 1 commit intorails:7-0-stablefrom
mainio:fix/7-0-logger-uninitialized-constant

Conversation

@ahukkanen
Copy link

@ahukkanen ahukkanen commented Jan 16, 2025

Motivation / Background

This Pull Request has been created because the concurrent-ruby gem's version 1.3.5 no longer loads the logger gem which breaks the internal logic of the ActiveSupport::LoggerThreadSafeLevel module.

This relates to the following commit in the concurrent-ruby gem included in version 1.3.5: ruby-concurrency/concurrent-ruby@d7ce956

Detail

This Pull Request changes the assumption that concurrent-ruby loads the logger gem.

Additional information

Fixes #54260
Fixes #54263

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature. - Not sure how to test this as tests would need to be added for different versions of concurrent-ruby
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included. - I believe this is minor?

@ahukkanen ahukkanen force-pushed the fix/7-0-logger-uninitialized-constant branch from 760cdbe to 6a7c72c Compare January 16, 2025 09:28
@fatkodima fatkodima merged commit 491afff into rails:7-0-stable Jan 16, 2025
@ahukkanen ahukkanen deleted the fix/7-0-logger-uninitialized-constant branch January 16, 2025 09:58
@mamhoff
Copy link

mamhoff commented Jan 16, 2025

Dearest Rails core team, I know how annoying this is, but can this commit be released on RubyGems? It's breaking all test suites that rely on a working Rails 7.0...

@rafaelfranca
Copy link
Member

Dearest Rails core team, I know how annoying this is, but can this commit be released on RubyGems? It's breaking all test suites that rely on a working Rails 7.0...

You can point to the 7-0-stable branch. Rails 7.0 isn't supported anymore for bug fixes, so a release including that change is very unlikely https://rubyonrails.org/maintenance

@skipkayhil
Copy link
Member

skipkayhil commented Jan 16, 2025

You can also:

  • pin concurrent-ruby in the Gemfile: gem "concurrent-ruby", "< 1.3.5"
  • add logger to your Gemfile so it gets required by Bundler.require
  • require "logger" manually in your application

etc.

edit: Bundler.require actually happens too late, but the other two suggestions should still work

fatkodima added a commit to fatkodima/online_migrations that referenced this pull request Jan 16, 2025
Fryguy added a commit to Fryguy/manageiq that referenced this pull request Jan 16, 2025
Temporary pin down as concurrent-ruby 1.3.5 breaks Rails 7.0, and rails-core doesn't
plan to ship a new 7.0 to fix it. See rails/rails#54264
pelargir added a commit to CandleScience/solidus_reviews that referenced this pull request Jan 16, 2025
v1.3.5 no longer loads the logger gem. This breaks ActiveSupport.
See rails/rails#54264
tombye added a commit to alphagov/tech-docs-gem that referenced this pull request Jan 17, 2025
1.3.5 introduced a change that broke activesupport
(and so middleman, which uses it). It might be to
do with it dropping Logger as a dependency but
this is unclear. Full release notes are:

https://github.com/ruby-concurrency/concurrent-ruby/releases/tag/v1.3.5

The activesupport gem fixed this in v7-0-stable of
Rails:

rails/rails#54264

So we're waiting for middleman to pull that
version in. They have an issue for this:

middleman/middleman#2788
@grzuy grzuy mentioned this pull request Jan 19, 2025
texpert added a commit to texpert/camaleon-cms that referenced this pull request Jan 19, 2025
…m which breaks the internal logic of the ActiveSupport::LoggerThreadSafeLevel module, so require `logger` as early as possible. See rails/rails#54264 (comment)
eagletmt added a commit to cookpad/kuroko2 that referenced this pull request Jan 21, 2025
@skipkayhil
Copy link
Member

I am finding this surprisingly hard to fix in one of my projects. Somehow even adding gem "logger" to the Gemfile (and yes, before rails) does not resolve it.

You're right, it explicitly needs to be required before Active Support and Bundler.require comes after Rails framework requires in config/application.rb 🤔

Maybe the best place would be in config/boot.rb after require "bundler/setup" since that gets loaded by bin/rails?

michael-gratton added a commit to GetUp/identity-kooragang that referenced this pull request Jan 24, 2025
eagletmt added a commit to cookpad/barbeque that referenced this pull request Jan 24, 2025
michael-gratton added a commit to GetUp/identity-kooragang that referenced this pull request Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants