Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7050 +/- ##
=======================================
Coverage 98.33% 98.33%
=======================================
Files 1337 1335 -2
Lines 50012 49943 -69
=======================================
- Hits 49180 49113 -67
+ Misses 832 830 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.
Once credits are available, reopen this pull request to trigger a review.
Docker builds report
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
|
- Replace LOGGING dict with no-op (setup_logging runs before Django) - Remove structlog.configure block (handled by flagsmith-common) - Remove util/logging.py (JsonFormatter, GunicornJsonCapableLogger now in flagsmith-common) - Remove GUNICORN_LOGGER_CLASS from .env-ci (default in flagsmith-common) - Remove PROMETHEUS_HISTOGRAM_BUCKETS setting (uses library defaults) - Pin flagsmith-common to feat/logging-improvements branch
…OGGERS Use the released PyPI package instead of the git branch reference, and set the APPLICATION_LOGGERS env var default in run-docker.sh so that application loggers are configured at the correct level.
fb369d8 to
1fb1e72
Compare

docs/if required so people know about the feature.Changes
Contributes to Flagsmith/flagsmith-common#31
Migrates logging setup from Django settings to flagsmith-common's
setup_logging(), which runs before Django loads.LOGGING_CONFIG = Noneto prevent Django from wipingsetup_logging()configurationstructlog.configureblock (handled by flagsmith-common)util/logging.pyGUNICORN_LOGGER_CLASSfrom.env-cias it's no longer neededPROMETHEUS_HISTOGRAM_BUCKETSsetting (uses library defaults)>=3.5.0,<4How did you test this code?
Generic format (
LOG_FORMAT=generic)Boot logs:
Access log:
Error log:
ConsoleRendererwith ISO timestamps, no ANSI in non-TTYJSON format (
LOG_FORMAT=json)Boot logs:
{"timestamp": "2026-03-30T19:38:15.606912Z", "message": "Starting gunicorn 23.0.0", "levelname": "INFO", "logger_name": "gunicorn.error", "pid": 45196, "thread_name": "MainThread"}Access log (structured):
{"timestamp": "2026-03-30T19:38:22.630927Z", "time": "2026-03-30T19:38:22+00:00", "path": "/health/liveness/", "remote_ip": "127.0.0.1", "method": "GET", "status": "400", "user_agent": "curl/8.7.1", "duration_in_ms": 7, "response_size_in_bytes": 143, "message": "127.0.0.1 - - [30/Mar/2026:19:38:22 +0000] \"GET /health/liveness/ HTTP/1.1\" 400 143 \"-\" \"curl/8.7.1\" - -", "levelname": "INFO", "logger_name": "gunicorn.access", "pid": 45276, "thread_name": "MainThread"}Error log (structured):
{"timestamp": "2026-03-30T19:38:22.628454Z", "status_code": 400, "request": "<WSGIRequest: GET '/health/liveness/'>", "message": "Invalid HTTP_HOST header: 'invalid.example.com'. You may need to add 'invalid.example.com' to ALLOWED_HOSTS.", "levelname": "ERROR", "logger_name": "django.security.DisallowedHost", "pid": 45276, "thread_name": "MainThread", "exc_info": "Traceback (most recent call last):\n File \"/Users/kgustyr/dev/flagsmith/flagsmith-common/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py\", line 55, in inner\n response = get_response(request)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kgustyr/dev/flagsmith/flagsmith-common/.venv/lib/python3.12/site-packages/django/utils/deprecation.py\", line 119, in __call__\n response = self.process_request(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kgustyr/dev/flagsmith/flagsmith-common/.venv/lib/python3.12/site-packages/django/middleware/common.py\", line 48, in process_request\n host = request.get_host()\n ^^^^^^^^^^^^^^^^^^\n File \"/Users/kgustyr/dev/flagsmith/flagsmith-common/.venv/lib/python3.12/site-packages/django/http/request.py\", line 202, in get_host\n raise DisallowedHost(msg)\ndjango.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'invalid.example.com'. You may need to add 'invalid.example.com' to ALLOWED_HOSTS."}