Skip to content

Conversation

@takaokouji
Copy link

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:

uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)

This affects multiple CI jobs:

  • Ruby 2.6 Rails 6.0.6 (both SQLite and PostgreSQL)
  • Ruby 2.6 Rails 6.1.7 (both SQLite and PostgreSQL)

Root Cause

Ruby 3.1+ moved Logger to 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 use Logger::Severity before the Logger class is loaded.

Solution

Add require 'logger' at the top of test/test_helper.rb to 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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant