Fix Ruby 2.6+ Logger compatibility issue#1482
Open
takaokouji wants to merge 1 commit intocerebris:masterfrom
Open
Fix Ruby 2.6+ Logger compatibility issue#1482takaokouji wants to merge 1 commit intocerebris:masterfrom
takaokouji wants to merge 1 commit intocerebris:masterfrom
Conversation
Add explicit require 'logger' to fix NameError with Ruby 2.6 and Rails 6.0: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger This is needed because Ruby 3.1+ moved Logger to a separate gem, but the issue also affects Ruby 2.6 with certain Rails versions where Logger needs to be explicitly required before ActiveSupport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CI failures with Ruby 2.6 and Rails 6.0/6.1 by adding explicit
require 'logger'.Problem
Tests are failing on Ruby 2.6 with the following error:
This affects multiple CI jobs:
Root Cause
Ruby 3.1+ moved
Loggerto a separate gem (logger), requiring explicit loading. While this primarily affects Ruby 3.1+, the issue also manifests with Ruby 2.6 and certain Rails versions where ActiveSupport tries to useLogger::Severitybefore the Logger class is loaded.Solution
Add
require 'logger'at the top oftest/test_helper.rbto ensure Logger is loaded before ActiveSupport attempts to use it.Testing
This fix should resolve the failing CI jobs while maintaining compatibility with all Ruby/Rails combinations in the test matrix.
🤖 Generated with Claude Code