Chasing a Bug: Flip Production to DEBUG and Log Everything?
To catch an intermittent bug, a teammate wants to set the whole prod app to DEBUG and log full request and response bodies. Defend a safer approach.
Answer key reviewed by Branko Petric
Read first: Kubernetes Observability: Logs, Metrics, and Monitoring
Your decision
An intermittent bug only shows up in production. A teammate wants to flip the entire app to DEBUG log level and log full request and response bodies until they catch it. Do you agree, and what do you do instead?
The situation
An intermittent bug corrupts a small fraction of orders, and it only reproduces in production. It never appears in staging. A teammate wants to set the application's global log level to DEBUG and add a middleware that logs full request and response bodies for every call until they manage to catch a failing case.
Context
The service handles checkout, so requests include customer details and payment-related tokens. Logs are shipped to a hosted aggregator billed per gigabyte ingested and are retained for 30 days. The app already emits structured logs with a per-request correlation ID and has basic metrics and tracing wired up, though nobody has looked closely at the traces for the failing orders yet.
Related challenges
- p99 Latency Spiked Across a Microservice Chain
p99 latency jumped across a request that touches six services. A teammate wants to scale up the slowest-looking one. Defend how you find the real culprit.
- On-Call Is Drowning in Alerts. Silence Them?
A CPU alert pages constantly with no real impact. A teammate wants to silence it. Defend how you fix alerting properly.
- A 30-Second Blip Became a 2-Hour Outage. More Retries?
A brief downstream blip cascaded into a full-platform meltdown because every layer retried. A teammate wants to raise retry counts. Defend the real fix.
- We're Missing a Dimension, So Add user_id as a Label?
Debugging lacked per-user detail, so a teammate wants user_id and request_id as Prometheus labels. Prometheus is already under memory pressure. Defend the call.