Skip to main content

Logging

The Core includes logging services to give you visibility into your application's operations.

Log format

Configure how logs are output using app.traceJson:

  • false outputs plaintext logs for human readability during local development
  • true outputs JSON-formatted logs for machine parsing in production environments

Log levels

From most to least verbose:

LevelDescription
traceVerbose debugging with all technical details.
debugStandard debugging information.
infoNormal operational messages.
warnPotential issues that don't require immediate action.
errorCritical errors requiring intervention.

Each level automatically includes all less-verbose levels. Setting info will show info, warn, and error messages while filtering out trace and debug.

warning

Never use trace in production. This level logs sensitive data including secrets.

Filtering logs

Use app.traceLevel to control which messages appear.

Set a level as a string to apply it globally across your entire application:

app:
traceLevel: "info"

Name a specific Rust crate to override the global level for that crate:

app:
traceLevel: "info,hyper=debug"
note

Do not add a space between comma-separated items.

Target a module within a crate using :: notation to set the most granular level:

app:
traceLevel: "info,hyper=debug,sqlx::query=error"

More specific scopes override broader ones. In the example above, most logs appear at info level, hyper crate logs appear at debug, and only errors from sqlx::query appear.

Working with log levels

The Core includes many crates and modules. This section provides practical guidance for common scenarios.

General development

For day-to-day local development:

app:
traceLevel: "info"

This provides operational visibility such as server starts, request completions, database request and change summaries, and errors caused by clients, without overwhelming detail.

Debugging issues

When troubleshooting, follow this progression:

  1. Identify the source: If you see an error, the log line indicates which crate or module it originates from

  2. Increase verbosity temporarily: If the source is not obvious, lower the global level to debug or trace to see more detail

  3. Target the component: Once you have identified the relevant crate or module, remove the global setting and increase verbosity only for that component

Production

Use info or warn globally in production. Never use trace as it logs sensitive data including secrets.