filter-log-messages parameter

The filter-log-messages parameter is a Boolean that defines whether Liquibase should filter the log messages for potentially insecure data. For now, Liquibase checks for and filters out the Liquibase Hub API key. The default value is true.

Uses

Liquibase log messages represent the records of events that occur when running commands. With log messages, you can typically find the reason for errors or exceptions and troubleshoot a problem. However, before Liquibase sends all the information to STDERR or the log file, you can prevent sensitive data from being logged in the verbose log messages by using the filter-log-messages parameter.

You can also use the filter-log-messages parameter along with the logLevel parameter, which sets the amount of messages generated when running Liquibase commands.

Although, there may be cases when you need to set the filter-log-messages parameter to false:

  • If you are trying to debug something related to a password or key and the filtered log messages can be helpful
  • If you want to improve performance without checking log message strings. For example, when you use the FINE logging or other times when there are a lot of log messages.

Setting the filter-log-messages parameter

You can set the filter-log-messages parameter in one of the following ways:

filter-log-messages as a Java system property

You can set the filter-log-messages parameter as a Java system property from your command line:

java -Dliquibase.filterLogMessages=<true|false>

You can also set it with the JAVA_OPTS Environment Variable.

The syntax for Mac/Linux:

JAVA_OPTS=-Dliquibase.filterLogMessages=<true|false>

The syntax for Windows, which requires the set command:

set JAVA_OPTS=-Dliquibase.filterLogMessages=<true|false>

filter-log-messages in the liquibase.properties file

You can set the filter-log-messages parameter by adding the following to your liquibase.properties file:

liquibase.filterLogMessages=<true|false>

filter-log-messages as a CLI global parameter

You can use filter-log-messages as a global parameter in your command line with a Liquibase command, such as update:

liquibase --filter-log-messages=<true|false> update --changelog-file=dbchangelog.xml

filter-log-messages as an environment variable

If you use Liquibase Pro, you can set filter-log-messages as an environment variable.

The syntax for Mac/Linux:

LIQUIBASE_FILTER_LOG_MESSAGES=<true|false>

The syntax for Windows, which requires the set command:

set LIQUIBASE_FILTER_LOG_MESSAGES=<true|false>

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.