Use JSON-format structured logging in production#882
Conversation
Test coverage91.72% line coverage reported by SimpleCov. |
7b1c1fc to
7de7d5f
Compare
This is necessary for Flipper and ActionDispatch::HostAuthorization messages to go through Semantic Logger and be correctly formatted as JSON.
a285328 to
0e2d3e8
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces rails_semantic_logger to improve Rails log signal (e.g., controller/action payloads) and configures JSON structured logging for production output (intended for BetterStack/Heroku).
Changes:
- Add
rails_semantic_logger(andsemantic_logger) dependencies. - Configure production logging to emit JSON to STDOUT when
RAILS_LOG_TO_STDOUTis set, and set an application identifier. - Adjust Flipper logging configuration (explicitly disabled).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Gemfile.lock | Adds rails_semantic_logger and semantic_logger dependencies. |
| Gemfile | Adds rails_semantic_logger to the app dependencies. |
| config/initializers/flipper.rb | Explicitly disables Flipper check logging (comment needs to match behavior). |
| config/environments/production.rb | Configures JSON logging to STDOUT on Heroku via Semantic Logger settings. |
| config/application.rb | Sets Semantic Logger app name and (currently) globally sets JSON format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bc0e827. Configure here.
abcampo-iry
left a comment
There was a problem hiding this comment.
Looks reasonable to me

Status
What's changed?
application.rblooks like it also enables JSON logging in non-prod environments, however this only applies to the log files written to disk, not the logging output in standard out.Steps to perform after deploying to production
None.