rails_semantic_logger icon indicating copy to clipboard operation
rails_semantic_logger copied to clipboard

Deprecation warning with Rails 7 usage of `ActiveSupport::Deprecation` singleton

Open alexmalus opened this issue 2 years ago • 0 comments
trafficstars

Environment

Provide at least:

  • Ruby Version: 3.1.4
  • Rails Version: 7.1.2
  • Semantic Logger Version: 4.15.0
  • Rails Semantic Logger Version: 4.14.0
  • Other Application/framework names and versions: Puma 6.4.0
  • Rails configuration. Only need the settings related to Rails Semantic Logger and Semantic Logger.
  • Full Stack Trace, if an exception is being raised.

Note:

  • Issues reported here should be related to monkey patches applied to Rails to make it use Semantic Logger.
  • For other logging and appender related issues, please report the issue at [Semantic Logger](https://github.com/reidmorrison/semantic_logger/issues.

Expected Behavior

  • Deprecation warning is resolved

Actual Behavior

Running rails server with a condition causing Rails to cause an exception (like not all migrations being executed) outputs a deprecation warning traced back to this line:

https://github.com/reidmorrison/rails_semantic_logger/blob/93fed9edd0ba21490044e5fc7474c7b83eb2676c/lib/rails_semantic_logger/extensions/action_dispatch/debug_exceptions.rb#L10

Snippet from the logs:

Rails -- Exception: ActiveRecord::PendingMigrationError:

[..]

Rails -- DEPRECATION WARNING: Calling silence on ActiveSupport::Deprecation is deprecated and will be removed from Rails (use Rails.application.deprecators.silence instead) (called from log_error at /gem_path/rails_semantic_logger-4.14.0/lib/rails_semantic_logger/extensions/action_dispatch/debug_exceptions.rb:10)

Rails 7 deprecated ActiveSupport::Deprecation singleton usage. Mentioned: https://github.com/rails/rails/releases/tag/v7.1.0.beta1 -> Deprecate usage of the singleton ActiveSupport::Deprecation PR where deprecation has been made: https://github.com/rails/rails/pull/47354

Pull Request

  • Consider submitting a Pull Request with a fix for the issue.
    • This is particularly helpful when running newer Rails versions, since we are not running it yet.
  • Or, even a Pull request that only includes a test that reproduces the problem.

~Happy to submit a Pull Request, need the access right.~ I was unaware of https://docs.github.com/en/get-started/quickstart/contributing-to-projects.

alexmalus avatar Nov 17 '23 12:11 alexmalus