Skip to main content
Gateway uses log4j2 for structured logging. By default it writes JSON logs to stdout, which makes it compatible with most log aggregation platforms (Datadog, Loki, Splunk, ELK). You can tune logging behavior in two ways:
  • Environment variables — adjust log levels for specific packages without redeploying a config file
  • Config file — full control over appenders, patterns, and per-logger levels

Configure with environment variables

The default config reads these env vars. Set any of them in your deployment to adjust levels without touching the config file: To switch to JSON output for log aggregation, set LOG4J2_APPENDER_LAYOUT=json.

Use a config file

To further customize your logging at an individual logger-level, you can use a custom log4j configuration file. First, bind your custom log4j configuration file to the /app/resources/log4j2.xml path in the container. Here’s the default configuration file: