GioJSdocs
On this page

[logging]

The Rust server's log format: human-readable text, or one JSON object per line for log shippers.

gio.toml
[logging]
format = "json"

Reference

KeyDefaultDescription
format"text" | "json""text""text": human-readable lines with colors. "json": one object per line with ts (RFC 3339, UTC), level, msg and target, plus the event's fields and those of its spans - every line logged for a request carries request_id. Any other value stops startup.Env override: GIO_LOG_FORMAT

Behavior

  • GIO_LOG_FORMAT (json or text, any case) wins over the file, so one build can log text locally and JSON in its container. An invalid value is ignored with a warning: ignoring GIO_LOG_FORMAT="logfmt": expected "json" or "text".
  • The Node worker always writes JSON lines with the same core keys and the request id as requestId; this key only switches the server's own lines.
  • Levels are filtered with RUST_LOG for the server (default info) and GIO_LOG_LEVEL for the worker.
text
{"ts":"2026-10-06T12:00:01.204518Z","level":"info","msg":"request completed","target":"giojs_server","cache":"miss","method":"GET","path":"/posts/7","request_id":"0b8e3c52-7a1d-4f0e-9c3b-5d2a6e8f1a47","status":"200"}

Examples

JSON in production, text locally

Leave gio.toml at the default and set the variable where the logs are shipped:

Dockerfile
ENV GIO_LOG_FORMAT=json

Good to know

  • format = "logfmt" stops startup: invalid `logging.format`: unknown variant `logfmt`, expected `text` or `json`.
  • Event or span fields named ts, level, msg or target are written as field.<name> instead of overwriting the core keys.

Version history

VersionChanges
v0.1.0-beta.8Introduced, with GIO_LOG_FORMAT.