The Fix
pip install stripe==14.4.0a2
Based on closed stripe/stripe-python issue #776 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -53,14 +53,14 @@ def log_debug(message, **params):
if _console_log_level() == "debug":
print(msg, file=sys.stderr)
- logger.debug(msg)
+ logger.debug(msg, params)
# strip_log_formatter.py
import datetime
import json
from pythonjsonlogger import jsonlogger
class StripeJsonLogFormatter(jsonlogger.JsonFormatter): # pragma: no cover
def add_fields(self, log_record, record, message_dict):
"""
This method allows us to inject custom data into resulting log messages
"""
for field in self._required_fields:
log_record[field] = record.__dict__.get(field)
log_record.update(message_dict)
# Add timestamp and application name if not present
if 'timestamp' not in log_record:
now = datetime.datetime.utcnow()
log_record['timestamp'] = now.isoformat()
if 'application' not in log_record:
log_record['application'] = 'myapp'
if 'level' not in log_record:
log_record['level'] = record.levelname
jsonlogger.merge_record_extra(record, log_record, reserved=self._skip_fields)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install stripe==14.4.0a2\nWhen NOT to use: This fix should not be used if the logging format must remain unchanged.\n\n
Why This Fix Works in Production
- Trigger: If we made that change, then you would have access to the underlying params used to construct the log message when defining your own formatter, so there should…
- Mechanism: The logger methods did not allow passing parameters for custom formatting
- Why the fix works: Allows users to pass parameters into the logger methods, enabling custom log formatting without monkey-patching the library. (first fixed release: 14.4.0a2).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- The logger methods did not allow passing parameters for custom formatting
- Production symptom (often without a traceback): If we made that change, then you would have access to the underlying params used to construct the log message when defining your own formatter, so there should be no need to monkey-patch/modify "logfmt" in util.
Proof / Evidence
- GitHub issue: #776
- Fix PR: https://github.com/stripe/stripe-python/pull/913
- First fixed release: 14.4.0a2
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.47
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hello @neilpanchal”
“@richardm-stripe This would work well, thanks for taking the time to address. We've since removed logging stripe records, so I am not able to test…”
“Anybody else feel free to chime in, too! We're happy to merge https://github.com/stripe/stripe-python/pull/913 and we think this solves the use case here, but we want…”
Failure Signature (Search String)
- If we made that change, then you would have access to the underlying params used to construct the log message when defining your own formatter, so there should be no need to
Copy-friendly signature
Failure Signature
-----------------
If we made that change, then you would have access to the underlying params used to construct the log message when defining your own formatter, so there should be no need to monkey-patch/modify "logfmt" in util.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
If we made that change, then you would have access to the underlying params used to construct the log message when defining your own formatter, so there should be no need to monkey-patch/modify "logfmt" in util.
Minimal Reproduction
# strip_log_formatter.py
import datetime
import json
from pythonjsonlogger import jsonlogger
class StripeJsonLogFormatter(jsonlogger.JsonFormatter): # pragma: no cover
def add_fields(self, log_record, record, message_dict):
"""
This method allows us to inject custom data into resulting log messages
"""
for field in self._required_fields:
log_record[field] = record.__dict__.get(field)
log_record.update(message_dict)
# Add timestamp and application name if not present
if 'timestamp' not in log_record:
now = datetime.datetime.utcnow()
log_record['timestamp'] = now.isoformat()
if 'application' not in log_record:
log_record['application'] = 'myapp'
if 'level' not in log_record:
log_record['level'] = record.levelname
jsonlogger.merge_record_extra(record, log_record, reserved=self._skip_fields)
What Broke
Users were unable to format logs in JSON, leading to inconsistent log outputs.
Why It Broke
The logger methods did not allow passing parameters for custom formatting
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install stripe==14.4.0a2
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/stripe/stripe-python/pull/913
First fixed release: 14.4.0a2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the logging format must remain unchanged.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 14.4.0a2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.