Fix HttpLog never being loaded in production environment regardless of log level#35825
Closed
ClearlyClaire wants to merge 1 commit intomainfrom
Closed
Fix HttpLog never being loaded in production environment regardless of log level#35825ClearlyClaire wants to merge 1 commit intomainfrom
ClearlyClaire wants to merge 1 commit intomainfrom
Conversation
debug Rails log levelbc793d7 to
609b71e
Compare
renchap
approved these changes
Aug 19, 2025
mjankowski
reviewed
Aug 19, 2025
|
|
||
| # Change to "debug" to log everything (including potentially personally-identifiable information!) | ||
| config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info') | ||
| config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')&.to_sym |
Contributor
There was a problem hiding this comment.
This is probably fine and will fix the comparison, but two thoughts:
- The template this comes from uses a string - https://github.com/rails/rails/blob/v8.0.2.1/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt#L45 - which makes me think this value is meant to be set from this config value, but then maybe not checked/introspected that way? I think the logger level setters are pretty resilient and will assign the right internal integer log level whether they get a string/symbol/int
- Could try something like
Rails.logger.debug?in that httplog initializer instead of the string/symbol thing -- in case something else other than thisconfig.log_levelmanipulates the log level?
Contributor
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
I think this would be a better alternative indeed!
Contributor
Author
There was a problem hiding this comment.
Do you want to open such a PR to replace this one?
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.
The initializer is testing for a symbol, but
config/environments/production.rbset it from environment as a string.