TwP / logging

A flexible logging library for use in Ruby programs based on the design of Java's log4j library.
https://rubygems.org/gems/logging
MIT License
530 stars 101 forks source link

NoMethodError: undefined method `formatter=' #245

Closed mhenrixon closed 3 weeks ago

mhenrixon commented 9 months ago
NoMethodError: undefined method `formatter=' for #<Logging::Logger:0x000000010d66fec8 @name="Application", @parent=#<Logging::RootLogger:0x000000010d5436d0 @name="root", @appenders=[], @additive=false, @caller_tracing=false, @level=0>, @appenders=[], @additive=true, @level=1, @caller_tracing=false>
/Users/mhenrixon/Code/mhenrixon/template/config/environment.rb:7:in `<main>'
Tasks: TOP => zeitwerk:check => environment

Looks like rails 7.1 broke something that you are using because since upgrading ruby on rails to .rc2 I get an error using libraries that depend on logging.

Figured I let you know.

brandondrew commented 8 months ago

I'm getting this with Rails 7.0.7.2

 undefined method `formatter=' for #<Logging::Logger:0x0000000123555d38 @name="Application", @parent=#<Logging::RootLogger:0x0000000117f18c50 @name="root", @appenders=[#<Logging::Appenders::Stdout:0x00000001229fed90 @io=#<IO:<STDOUT>>, @close_method=:close, @buffer=[], @immediate=[], @auto_flushing=1, @async=false, @async_flusher=nil, @flush_period=nil, @name="stdout", @closed=false, @filters=[], @mutex=#<ReentrantMutex:0x00000001229da878 @locker=nil>, @layout=#<Logcraft::LogLayout:0x00000001229bb8b0 @global_context={}, @formatter=#<Proc:0x0000000121a33e60 /Users/brandon/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/logcraft-2.1/lib/logcraft/log_layout.rb:7 (lambda)>, @level_formatter=#<Proc:0x0000000121a33de8 /Users/brandon/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/logcraft-2.1/lib/logcraft/log_layout.rb:8 (lambda)>>, @level=0, @encoding=#<Encoding:UTF-8>, @write_size=500>], @additive=false, @caller_tracing=false, @level=1>, @appenders=[], @additive=true, @level=1, @caller_tracing=false> (NoMethodError)

        logger.formatter = ActiveSupport::Logger::SimpleFormatter.new
              ^^^^^^^^^^^^