output-line-separator parameter

The output-line-separator global parameter determines the string that separates lines in STDOUT, such as when you use the updateSQL command or the futureRollbackSQL command. By default, it is set to the line separator used by the operating system:

  • Mac/Linux: LF (line feed; encoded as \n)

  • Windows: CR LF (carriage return line feed; encoded as \r\n)

Uses

If you want to use a different character than your operating system’s default string as a line separator in Liquibase, you can set output-line-separator to a string value of any length. For example, you can set it to multiple newlines or a substring between two newlines.

If you want STDOUT to display all text in a single line, you can set output-line-separator to a non-newline character. The character you set delimits each substring in STDOUT.

Setting the output-line-separator parameter

You can set output-line-separator in four ways:

  • As a JVM system property
  • In your liquibase.properties file
  • As a global parameter in the CLI
  • As an environment variable (Liquibase Pro)

Java system property

You can set output-line-separator as a Java system property from your command line:

java -Dliquibase.outputLineSeparator=YOUR_SEPARATOR

You can also set it with the JAVA_OPTS Environment Variable. The syntax on Mac/Linux is as follows:

JAVA_OPTS=-Dliquibase.outputLineSeparator=YOUR_SEPARATOR && liquibase update-sql --changelog-file=dbchangelog.xml

The syntax on Windows requires the set command:

set JAVA_OPTS=-Dliquibase.outputLineSeparator=YOUR_SEPARATOR && liquibase update-sql --changelog-file=dbchangelog.xml

liquibase.properties parameter

In Liquibase 4.1+, you can set output-line-separator by adding the following to your liquibase.properties file:

liquibase.outputLineSeparator: YOUR_SEPARATOR

CLI global parameter

You can use output-line-separator as a global parameter in your command line with a single Liquibase command, such as update-sql:

liquibase --output-line-separator=YOUR_SEPARATOR update-sql --changelog-file=dbchangelog.xml

If you want to use multiple newlines as your line separator, you can set output-line-separator as follows:

liquibase --output-line-separator="

" update-sql --changelog-file=dbchangelog.xml

Environment variable (Liquibase Pro)

If you use Liquibase Pro, you can set output-line-separator as an environment variable. The syntax on Mac/Linux is as follows:

LIQUIBASE_OUTPUT_LINE_SEPARATOR=YOUR_SEPARATOR

The syntax on Windows requires the set command:

set LIQUIBASE_OUTPUT_LINE_SEPARATOR=YOUR_SEPARATOR

Note: The commands shown above only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.

Related links