Enable structured logging

Last updated: July 14, 2025

Tip: We recommend using --log-format=JSON for most use cases, especially when logs are being sent to third-party observability or log management tools. This format is optimized for machine processing and ensures maximum compatibility with structured logging pipelines. You should only use JSON_PRETTY for quick, manual inspection.

Procedure

1

Set the --license-key property using your Liquibase Pro license key.

2

Set the --log-format property to JSON or JSON_PRETTY.

  • CLI: liquibase --log-format=JSON or JSON_PRETTY

  • Properties file: liquibase.logFormat=JSON or JSON_PRETTY

  • Environment Variable: LIQUIBASE_LOG_FORMAT=JSON or JSON_PRETTY

3

Set the --log-level property to a value other than OFF.

Use this to define what to include in your structured logs. Valid values are FINE, INFO, WARN, and SEVERE.

4

(Optional) Set the --log-file properties so the log data is sent to a file rather than to the console.

This is useful if you want to capture a file to be ingested by your log analysis tool, such as Elastic or Cloudwatch, etc.

To do so, set the --log-file property equal to the log file of your choice in the file, as an environment variable, or in the CLI.

Example: liquibase --log-format=JSON_PRETTY --log-level=INFO update --log-file=mylogfile.log

Note: By default, console messages are included in your log. If you need to disable this, set mirror-console-messages-to-log to false.