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

Duplicate Rails.logger before assigning it to the SDK #2086

Merged
merged 2 commits into from
Aug 9, 2023

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Aug 6, 2023

I discovered this while investigating #2031: If we don't duplicate Rails.logger, configurations made to the SDK's logger will be applied to the Rails logger as well.

For example, in an Rails app:

Sentry.init do |config|
  config.logger.level = Logger::WARN
end

Will make the Rails logger's level to be Logger::WARN too. I think most users wouldn't expect this and will find it confusing.

If we don't duplicate it, logger configuration made to the SDK's logger
will be applied to the Rails logger as well.

For example, in an Rails app:

```rb
Sentry.init do |config|
  config.logger.level = Logger::WARN
end
```

Will make the Rails logger's level to be `Logger::WARN` as well.
@st0012 st0012 added the bug fix label Aug 6, 2023
@st0012 st0012 added this to the 5.11.0 milestone Aug 6, 2023
@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (bc0f8ce) 83.23% compared to head (b286e98) 83.23%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2086   +/-   ##
=======================================
  Coverage   83.23%   83.23%           
=======================================
  Files         119      119           
  Lines        5671     5674    +3     
=======================================
+ Hits         4720     4723    +3     
  Misses        951      951           
Files Changed Coverage Δ
sentry-rails/lib/sentry/rails/configuration.rb 100.00% <100.00%> (ø)
sentry-rails/spec/dummy/test_rails_app/app.rb 92.64% <100.00%> (ø)
sentry-rails/spec/sentry/rails_spec.rb 96.19% <100.00%> (+0.06%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@st0012 st0012 mentioned this pull request Aug 6, 2023
@st0012 st0012 merged commit 8abb2d2 into master Aug 9, 2023
97 checks passed
@st0012 st0012 deleted the duplicate-logger branch August 9, 2023 14:40
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.

2 participants