Repository navigation
Description
Rails structured logging automatically turns Rails ActiveRecord and ActionController events into Sentry logs. That makes it automatic logging instrumentation, so starting with sentry-rails 7.1.0 it will be off by default, like the rest of logs and metrics. The interpretation behind that behavior was that adding sentry-rails counted as the logging opt-in, analogous to adding a dedicated logging integration. But in that case it was too ambiguous; this is a corrective follow-up.
We're sorry for the disruption of changing a default within 7.x. We chose to make the change now instead of waiting for 8.0, so that everyone adopting logs gets the same, predictable behavior from the start.
Make Rails structured logging opt-in
Users who want Rails structured logs should enable them explicitly:
Sentry.init do |config|
config.rails.structured_logging.enabled = true
endImplementation notes
Background
- Before 7.0,
config.rails.structured_logging.enabledfollowed the globalenable_logsoption. feat!: Remove enable_logs #3053 removedenable_logsin 7.0 and set the Rails default totrue. - 7.1.0 makes it opt-in: an unset option means off, and sentry-rails logs a warning at boot until the option is set explicitly. Both the warning and the "unset" state are removed in 8.0.
Sentry.logger.*stays available regardless of this setting. No globalenable_logsgate and no double opt-in.
SDK (sentry-rails 7.1.0)
- Default
structured_logging.enabledtotrueornil(unset), treated as off - Changelog entry via the PR description
- Changelog entry explaining new default
Docs (sentry-docs, released with 7.1.0)
- Rails quickstart snippet (
platform-includes/getting-started-config/ruby.rails.mdx): addconfig.rails.structured_logging.enabled = true - Rails logs setup (
platform-includes/logs/setup/ruby.rails.mdx): opt-in wording and snippet - Rails logs options (
platform-includes/logs/options/ruby.rails.mdx): opt-in wording, enable/disable sections - Rails logs page (
docs/platforms/ruby/guides/rails/logs/index.mdx): troubleshooting and requirements ("opt-in since 7.1.0")
Release and follow-up
- Pin this issue when 7.1.0 is released
- 7.2: remove the
post_install_message
Activity
linear-code commentedon Sep 28, 2026
RUBY-219
[-][Rails] Default structured logging to off and require explicit opt-in[/-][+]Default structured logging to off and require explicit opt-in[/+]