Skip to content

Fix uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger error#54621

Merged
byroot merged 1 commit intorails:6-1-stablefrom
bacxadev:fix-logger_thread_safe_level
Feb 25, 2025
Merged

Fix uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger error#54621
byroot merged 1 commit intorails:6-1-stablefrom
bacxadev:fix-logger_thread_safe_level

Conversation

@bacxadev
Copy link

🔹 Pull Request Title
Fix missing logger dependency in activesupport/lib/active_support/logger_thread_safe_level.rb

📌 Description
This PR fixes an issue in activesupport/lib/active_support/logger_thread_safe_level.rbcaused by a missing require "logger"

🚀 Issue
After upgrading the concurrent-ruby gem, the library removed an implicit require "logger" statement. As a result, activesupport/lib/active_support/logger_thread_safe_level.rb fails due to an uninitialized constant.

ruby-concurrency/concurrent-ruby#1062

🔍 Fix
Explicitly add require "logger" in activesupport/lib/active_support/logger_thread_safe_level.rb to ensure the dependency is always loaded.

✅ Checklist

  • Verified the fix locally
  • Ensured no other dependencies are affected
  • All tests pass successfully

@byroot byroot enabled auto-merge February 25, 2025 15:02
auto-merge was automatically disabled February 25, 2025 15:06

Head branch was pushed to by a user without write access

@bacxadev bacxadev force-pushed the fix-logger_thread_safe_level branch 2 times, most recently from de5dd25 to aa2d381 Compare February 25, 2025 15:09
@bacxadev bacxadev force-pushed the fix-logger_thread_safe_level branch from aa2d381 to 3f4f75d Compare February 25, 2025 15:31
@byroot
Copy link
Member

byroot commented Feb 25, 2025

I'm merging this, but just to be clear, 6.1 won't see any more releases.

@byroot byroot merged commit 23ec2ca into rails:6-1-stable Feb 25, 2025
1 of 2 checks passed
wasifhossain added a commit to rails-api/active_model_serializers that referenced this pull request Oct 28, 2025
Context:

/home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:16:in `<module:LoggerThreadSafeLevel>': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)

rails/rails#54621
Andryu pushed a commit to Andryu/simple_mysql_partitioning that referenced this pull request Jan 25, 2026
Root cause:
- concurrent-ruby 1.3.5 removed logger as a dependency
- Rails 6.1 ActiveSupport expects Logger to be pre-loaded
- This causes: NameError: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger

Solution:
- Pin concurrent-ruby to ~> 1.3.0, < 1.3.5 in gemspec
- Remove unnecessary active_support/all requires from lib and spec files
- concurrent-ruby 1.3.4 still auto-loads Logger, fixing the issue

References:
- rails/rails#54271
- rails/rails#54272
- rails/rails#54621

This fixes all Rails 6.1 test failures.
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.

3 participants