You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert server access log to structured context logging
Replace Apache Combined Log Format with structured key-value/JSON output
using the existing LOG_FORMAT formatter system. Access log fields are
fully configurable via SERVER_ACCESS_LOG_FIELDS, with a verbose default
for production and a minimal set in plain dev.
The server writes access logs to a separate `plain.server.access` logger that always outputs to stdout, regardless of the `LOG_STREAM` setting. This keeps access logs separate from application logs.
197
197
198
+
Access logs use the same `LOG_FORMAT` setting as the app logger, producing structured output with request fields:
Additional fields beyond the defaults are controlled by `SERVER_ACCESS_LOG_FIELDS` (see the server docs).
211
+
198
212
Access logging is controlled by the `SERVER_ACCESS_LOG` setting (see the server docs). Individual responses can opt out by setting `response.log_access = False`.
Use `url` for a combined path + query string (e.g., `url="/search?q=hello"`). Use `path` and `query` separately for production log aggregation.
117
+
118
+
In development, `plain dev` sets a minimal field list for cleaner output (`method`, `url`, `status`, `duration_ms`, `size`). Set `PLAIN_SERVER_ACCESS_LOG_FIELDS` in your environment to override.
119
+
91
120
### Per-response access log control
92
121
93
122
Individual responses can opt out of the access log by setting `log_access = False` on the response object. This is useful for noisy endpoints like health checks or asset serving.
0 commit comments