reidmorrison / rails_semantic_logger

Rails Semantic Logger replaces the Rails default logger with Semantic Logger
https://logger.rocketjob.io/rails
Apache License 2.0
320 stars 114 forks source link

Rails 7.1.2 compatibility issues - undefined method `info' for nil:NilClass #205

Closed rgaufman closed 7 months ago

rgaufman commented 8 months ago

Environment

I am getting this error:

     # NoMethodError:
     #   undefined method `info' for nil:NilClass
     #   ./app/models/camera.rb:325:in `handle_changes'

I have this in my class definition:

class Camera < ApplicationRecord
  include SemanticLogger::Loggable

And doing this in my class method:

  def handle_changes
    logger.warn("test")
  end

Any ideas?

It works fine downgrading to Rails 7.0.8

rgaufman commented 7 months ago

Any solution to this? - is semantic_logger no longer recommended with Rails?

rgaufman commented 7 months ago

Turns out my issue was entirely unrelated to semantic_logger and in fact it was me setting the good_job logger to Rails.logger. Removing that fixed the problem. Apologies for the false alarm.