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: remove undef :broadcast since ActiveSupport::Logger dropped it #194

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

Amnesthesia
Copy link
Contributor

Issue # (if available)

Rails 7.1 dropped this method from ActiveSupport::Logger so trying to undefine it throws on boot

Description of changes

Removed that one undef line

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camsteffen
Copy link

Fixes #191

@@ -4,7 +4,7 @@ module ActiveSupport
# More hacks to try and stop Rails from being it's own worst enemy.
class Logger
class << self
undef :logger_outputs_to?, :broadcast
undef :logger_outputs_to?
Copy link
Contributor

Choose a reason for hiding this comment

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

We still need to undef :broadcast for the previous Rails versions to prevent a warning, please undef_method(:broadcast) if method_defined?(:broadcast) like here

Also should be tested, please add 7.1 to CI. I guess here Rails-7.0 could be replaced by 7.1

Copy link
Contributor

Choose a reason for hiding this comment

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

...and CI would probably fail, because we're undefining methods only to override it later, since it's not defined anymore and replaced with other API -- some functionality would be broken.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks similar to sidekiq/sidekiq@20cdf68, but didn't checked the code

Copy link
Contributor

Choose a reason for hiding this comment

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

Made a PR to fix it rails/rails#49563, will wait a couple of days for feedback and [if accepted] would try to make a PR to rails_semantic_logger, probably with out-of-the-box monkeypatch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added 7.1 to the matrix and implemented @camsteffen's solution above

Choose a reason for hiding this comment

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

Made a PR to fix it rails/rails#49563, will wait a couple of days for feedback and [if accepted] would try to make a PR to rails_semantic_logger, probably with out-of-the-box monkeypatch.

looks like a patch was merged into Rails
rails/rails#49621

Choose a reason for hiding this comment

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

running

  gem "rails_semantic_logger", git: "https://github.com/Amnesthesia/rails_semantic_logger.git", branch: "fix/rails7.1"
  gem "rails", git: "https://github.com/rails/rails.git", branch: "7-1-stable"

all is working

❯ DEPENDENCIES_NEXT=1 rc
Loading development environment (Rails 7.1.1)
 development  irb(main):001> 

Copy link

@joshRpowell joshRpowell left a comment

Choose a reason for hiding this comment

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

working for us https://github.com/reidmorrison/rails_semantic_logger/pull/194/files#r1363832270
need to wait for next rails release that includes rails/rails#49621

@vishalzambre
Copy link

working for us https://github.com/reidmorrison/rails_semantic_logger/pull/194/files#r1363832270 need to wait for next rails release that includes rails/rails#49621

This is merged

@severinkaelin
Copy link

We're running this branch (Amnesthesia:fix/rails7.1) with the 7-1-stable one of rails in production. No issues so far. Thanks a lot for the work!

@Amnesthesia @reidmorrison Are there further changes needed from you point of view or can this be merged and released?

@Amnesthesia
Copy link
Contributor Author

@severinkaelin Hey, nope — we're also running this in production without issues so far, just waiting for this to be merged!

@severinkaelin
Copy link

@.severinkaelin Hey, nope — we're also running this in production without issues so far, just waiting for this to be merged!

@Amnesthesia Great to hear! Thanks for confirming.

@reidmorrison Is there an ETA for getting this PR merged and a release cut? Would be great to see this published to RubyGems. Just let me know if I can be of any help. Many thanks.

ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
ojab added a commit to ojab/rails_semantic_logger that referenced this pull request Nov 8, 2023
`Logger#broadcast` was [removed in rails-7.1](reidmorrison#194),
we should handle this
@reidmorrison reidmorrison merged commit a800956 into reidmorrison:master Nov 9, 2023
13 of 17 checks passed
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.

9 participants