log-file

To log execution details of any command, use the log-file parameter. The log-file parameter sends logging messages of what Liquibase does during runtime to a file.

Uses

By default, Liquibase sends command output to STDOUT (the console). However, you can use log-file to record this information in a permanent location.

If you want to set the log level for your log file, you also need to specify the log-level parameter. If you don't specify the log-level parameter, the default log value will be SEVERE.

Example: log-file

liquibase --log-level=debug --log-file=../the/path/to/my/logs update

Example: log-file and output-file

To get the log and output information from a command, use the log-file and output-file parameters simultaneously:

liquibase --output-file=mysnapshot.json --log-level=debug --log-file=liquibase.log snapshot

Compressing log files

Log files can become very large. Liquibase supports compressing log files automatically when the file name ends with .gz.

Example command to compress a log file

liquibase --log-level=debug --log-file=../the/path/to/my/logs.gz update

In this example, Liquibase writes the log output as a compressed .gz file without requiring any additional information.

Syntax

You can set this parameter in the following ways:

Option

Syntax

Liquibase properties file (defaults file)

liquibase.logFile: <string>

Global flow file argument

globalArgs: { log-file: "<string>" }

Global CLI parameter

liquibase --log-file=<string> update --changelog-file=example-changelog.xml

JVM system property (JAVA_OPTS environment variable)

Unix:

JAVA_OPTS=-Dliquibase.logFile=<string>

Windows:

JAVA_OPTS=-D"liquibase.logFile"=<string>

Liquibase environment variable

LIQUIBASE_COMMAND_CHANGELOG_FILE=<string>