Repository navigation
Emit structured debug events in development only - #55657
Merged
Merged
Conversation
p8
reviewed
Sep 11, 2025
adrianna-chang-shopify
force-pushed
the
ac-no-debug-events-in-test
branch
from
September 11, 2025 20:11
d045d02 to
1850a9f
Compare
skipkayhil
approved these changes
Sep 11, 2025
skipkayhil
enabled auto-merge
September 11, 2025 20:15
3 of 4 tasks
4 tasks done
claudiob
added a commit
to claudiob/rails
that referenced
this pull request
Nov 22, 2025
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
claudiob
added a commit
to claudiob/rails
that referenced
this pull request
Nov 22, 2025
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
claudiob
added a commit
to claudiob/rails
that referenced
this pull request
Nov 22, 2025
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
claudiob
added a commit
to claudiob/rails
that referenced
this pull request
Nov 25, 2025
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
claudiob
added a commit
to claudiob/rails
that referenced
this pull request
Nov 25, 2025
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
claudiob
added a commit
to claudiob/rails
that referenced
this pull request
Nov 27, 2025
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
drymar
pushed a commit
to drymar/rails
that referenced
this pull request
Jan 5, 2026
This is a follow-up to rails#55657, a PR that enables debug events in development only. The problem is that some users might want to see debug events also in test or in production. A real-world example is detailed in rails#55900 (comment) This PR slightly changes the behavior replacing `Rails.env.development?` with `config.log_level == "debug"`. As explained in [Rails documentation](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels): > The default Rails log level is :debug. However, it is set to :info for the production environment > in the default generated config/environments/production.rb. As a result, this PR maintains the existing behavior when defaults are applied, but opens up the possibility to see debug events in production for those who want to do so: they simply have to set `RAILS_LOG_LEVEL=debug`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation / Background
Ref: #55566
Shopify's local Event Reporter emitted debug events in local environments (test and development), so I ported the change over to Rails. However, after further discussion with the team, we decided it's strange to emit debug events in test; this causes extra noise, and tests typically want to verify production behaviour, so emitting debug events by default causes a divergence.
This PR enables debug events in development only. Tests can verify debug events by enabling debug mode explicitly, e.g.
cc @skipkayhil @Edouard-chin
Before submitting the PR make sure the following are checked:
[Fix #issue-number]I haven't added a CHANGELOG entry because the prior behaviour technically wasn't documented.
We could also opt to make this configurable (and document the option), but not sure whether we want to encourage globally enabling / disabling it vs encouraging use of
with_debug.