Skip to content

Conversation

Watson1978
Copy link
Contributor

@Watson1978 Watson1978 commented Sep 5, 2025

Fix #100

require "bundler/inline"
gemfile do
  source "https://rubygems.org"
  gem "fluent-logger" #, path: "/home/watson/src/fluent-logger-ruby"
  gem "logger", "= 1.6.0"
end

f = Fluent::Logger::LevelFluentLogger.new('fluent')
f.info("some application running.")
p f.level

The compatibility has lost since logger gem v1.6.0.
So, the above code causes following NoMethodError error.

$ ruby logger.rb
E, [2025-09-05T18:03:49.313233 #102418] ERROR -- : Failed to connect fluentd: Connection refused - connect(2) for "localhost" port 24224
E, [2025-09-05T18:03:49.313616 #102418] ERROR -- : Connection will be retried.
E, [2025-09-05T18:03:49.314104 #102418] ERROR -- : FluentLogger: Can't send logs to localhost:24224: Connection refused - connect(2) for "localhost" port 24224
/home/watson/.rbenv/versions/3.4.5/lib/ruby/gems/3.4.0/gems/logger-1.6.0/lib/logger.rb:384:in 'Logger#level': undefined method '[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @level
                   ^^^^^^^^^^^^^^^
        from logger.rb:10:in '<main>'

We should call super in inherited class.

FYI:
This problem will be fixed with logger 1.7.0 with ruby/logger@1efdf6b

@Watson1978 Watson1978 requested a review from daipom September 5, 2025 09:08
Copy link
Contributor

@daipom daipom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@daipom daipom merged commit 6bcebac into fluent:master Sep 8, 2025
4 checks passed
@Watson1978 Watson1978 deleted the super branch September 9, 2025 01:32
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.

Incompatible with logger 1.6.0
2 participants