Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix log subscriber #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

shahidkhaliq
Copy link

@shahidkhaliq shahidkhaliq commented May 1, 2024

Using both rails_semantic_logger and activejob-uniqueness together in Rails 6.0.x results in duplicated logs as reported in #73.

The Issue

  1. Rails 6.0.x has ActiveJob::Logging::LogSubscriber.attach_to :active_job.
  2. activejob-uniqueness has ActiveJob::LogSubscriber.attach_to :active_job_uniqueness.
  3. rails_semantic_logger expects to see one of these but replaces both of these with it's own logger here. And thus duplicating logging.

The Solution

This PR ensures that we are creating and attaching a unique log subscriber ActiveJob::Uniqueness::LogSubscriber and not creating the ActiveJob::LogSubscriber class in older Rails versions.

@shahidkhaliq
Copy link
Author

@sharshenov could you take a look, please?

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.

None yet

1 participant