Skip to content

Fix production logging: disable Sentry debug, drop log_level to info - #887

Merged
maxkadel merged 1 commit into
mainfrom
fix-sentry-debug-logging
Sep 8, 2026
Merged

maxkadel merged 1 commit into
mainfrom
fix-sentry-debug-logging

Conversation

@maxkadel

@maxkadel maxkadel commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Removes config.debug = true from the Sentry initializer.
  • Sets config.log_level to ENV.fetch("RAILS_LOG_LEVEL", "info"), matching pals' existing pattern - was still on Rails' stock :debug default.

Why

Found while investigating why some of utk-hyku's application logs weren't reliably reaching Loki. With Sentry's debug: true, the SDK logs its full outgoing event payload - including a modules hash of every loaded gem and version, hundreds of entries - as a single DEBUG log line every time an error is captured. These lines run 100KB-485KB+, well past Loki's 256KB per-entry limit, so Loki rejects the entire batch each time (max entry size '262144' bytes exceeded) - meaning legitimate log lines batched alongside the oversized one get silently dropped too.

Separately, config.log_level = :debug was still Rails' unmodified generator default (never actually set deliberately for this app) - the real source of the constant ActiveRecord/CanCan DEBUG-level noise seen throughout. pals (palni_palci_knapsack) already uses ENV.fetch("RAILS_LOG_LEVEL", "info"); this brings utk-hyku in line.

🤖 Generated with Claude Code

Sentry's config.debug = true logged the SDK's full outgoing event
JSON (including every loaded gem's version, hundreds of entries) at
DEBUG level on every captured error - single lines up to ~485KB, past
Loki's 256KB per-entry limit, causing Loki to drop the whole batch and
silently lose real log lines alongside it.

Rails' own config.log_level was still at the stock :debug default
(never actually set for this app), which is the root source of the
constant DEBUG-level query/permission-check noise. Matches pals'
existing ENV.fetch("RAILS_LOG_LEVEL", "info") pattern.
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Test Results

209 484 tests  ±0   209 484 ✅ ±0   0s ⏱️ ±0s
      1 suites ±0         0 💤 ±0 
      1 files   ±0         0 ❌ ±0 

Results for commit 276a005. ± Comparison against base commit d9669f7.

@maxkadel
maxkadel merged commit 49be6c6 into main Sep 8, 2026
16 checks passed
@maxkadel
maxkadel deleted the fix-sentry-debug-logging branch September 8, 2026 15:03
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