You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I updated JSP recently, but am running into an issue that I can't figure out. I narrowed it down to the new :logger change in Noticed 1.6.3, and when I downgrade to 1.6.2, my test failures go away. Note that I am also using rails_semantic_logger and silencer (I wish I didn't need silencer, but the filtering in semantic_logger isn't working for me). More on this later.
I started getting many failures, related to whenever a notification was generated: Minitest::UnexpectedError: NoMethodError: undefined method tagged' for nil:NilClass`
Here's a gist of the test failures.
I eventually settled on a monkey-patch that "fixes" it:
# initializer
module Extensions
module ActiveJob
module Logging
def tag_logger(*tags, &block)
if logger.nil?
@logger = ::ActiveJob::Base.logger
end
logger.tagged(*tags, &block)
end
end
end
end
ActiveJob::Logging.prepend(Extensions::ActiveJob::Logging)
If I remove either Silencer (2.0.0) or rails_semantic_logger (4.12.0) and I don't have the monkeypatch enabled, it no longer fails. So it seems some sort of crazy interaction between the three libraries.
From what I have found, it seems by the time the tag_logger method is called, SemanticLogger has replaced the activejob version of tag_logger with its own.
I'm not sure if I'm missing something else here, have you seen this before? While my tests are passing again with a monkeypatch, I'm not sure if other problems might pop up in dev or production. And ideally, I'd like avoid a monkeypatch if at all possible.
I also tried adding logger: Rails.logger to the deliver_by in ApplicationNotification with no luck.
class ApplicationNotification < Noticed::Base
# Delivery methods and helpers used by all notifications can be defined here.
deliver_by :database, format: :to_database, logger: Rails.logger
I was wondering if you could explain the context of how the :logger option is normally set?
I can confirm I'm running in the same issue. We are also running rails_semantic_logger (4.12.0), but without silencer. The same tag_logger method is affected with NoMethodError: undefined method `tagged' for nil:NilClass
I updated JSP recently, but am running into an issue that I can't figure out. I narrowed it down to the new
:logger
change in Noticed 1.6.3, and when I downgrade to 1.6.2, my test failures go away. Note that I am also usingrails_semantic_logger
andsilencer
(I wish I didn't need silencer, but the filtering in semantic_logger isn't working for me). More on this later.I started getting many failures, related to whenever a notification was generated:
Minitest::UnexpectedError: NoMethodError: undefined method
tagged' for nil:NilClass`Here's a gist of the test failures.
I eventually settled on a monkey-patch that "fixes" it:
If I remove either
Silencer
(2.0.0) orrails_semantic_logger
(4.12.0) and I don't have the monkeypatch enabled, it no longer fails. So it seems some sort of crazy interaction between the three libraries.From what I have found, it seems by the time the tag_logger method is called, SemanticLogger has replaced the activejob version of tag_logger with its own.
I'm not sure if I'm missing something else here, have you seen this before? While my tests are passing again with a monkeypatch, I'm not sure if other problems might pop up in dev or production. And ideally, I'd like avoid a monkeypatch if at all possible.
I also tried adding
logger: Rails.logger
to the deliver_by in ApplicationNotification with no luck.I was wondering if you could explain the context of how the
:logger
option is normally set?noticed/lib/noticed/delivery_methods/base.rb
Line 9 in c4b364e
What I see when looking at the source in pry:
For some reason
logger
on line 83 is nil, and I can't figure out how to set it without a monkeypatch.Thanks!
The text was updated successfully, but these errors were encountered: