log-level
The --log-level
parameter controls the amount of messages that are generated when running Liquibase commands. You can set --log-level
to the following values:
SEVERE
(least verbose): Show serious failures that may prevent program execution.WARNING
: Show potential problems for program execution.INFO
: Show informational messages.FINE
(most verbose; formerlyDEBUG
): Show tracing information of program execution and minor failures.OFF
: Hide all log messages.
If you set --log-level
to a particular level, it will show all messages at that level and at less verbose levels. For example, setting the log level to SEVERE
only shows SEVERE
logs, but setting it to FINE
shows FINE
, INFO
, WARNING
, and SEVERE
logs.
The --log-level
default value is OFF
. However, if you use the --log-file
attribute to send your logs to a different file and don't specify the --log-level
parameter, Liquibase will automatically change the --log-level
default value from OFF
to SEVERE
.
Uses
The --log-level
parameter applies to all Liquibase commands. It can be used to get more information about the actions that Liquibase commands perform, as well as provide helpful information to resolve errors.
The value of SEVERE
provides messages regarding serious errors. You may find it useful to set the --log-level
to INFO
to see a more complete list of the operations that a command performs. Use the FINE
level to help resolve errors.
Using the --log-level
parameter
Tip: For best results, specify all commands and parameters in the --kebab-case
format in the CLI. If your preference is camelCase, it also works in the CLI.
--log-level
is an optional parameter that is either set in the Liquibase properties file or specified on the command line. The --log-level
specified on the command line overrides the value set in the properties file.
Examples
liquibase --log-level=FINE update
liquibase --log-level=INFO update-testing-rollback
Maven
If you use Maven, you can control the log level of Liquibase Maven plugin with MAVEN_OPTS
by passing the following command: MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG
. You can also edit the log level in the ${maven.home}/conf/logging/simplelogger.properties
file.
Note: To disable the logging, run MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=OFF
. For more information, see Configuring logging.
Syntax
You can set this parameter in the following ways:
Option | Syntax |
---|---|
Liquibase properties file (defaults file) |
|
Global flow file argument (example) |
|
Global CLI parameter |
|
JVM system property (JAVA_OPTS Environment Variable) |
|
Liquibase Environment Variables |
|
For more information, see Working with Command Parameters.
Using the --sql-log-level
property alongside --log-level
The SQL log level is set to FINE
by default. This behavior can be modified using --sql-log-level
property.
For example, if you would like the log SQL statements to have the INFO
log level, then you would specify --sql-log-level=INFO
in your Liquibase command:
liquibase --sql-log-level=INFO --log-level=INFO update
Note: The --log-level
property is required for --sql-log-level
to operate successfully.
Other ways to specify --sql-log-level
- Define the JAVA_OPTS Environment Variable prior to running your Liquibase command:
- Define environment variables:
- Command line argument:
liquibase.properties
setting:
JAVA_OPTS="-Dliquibase.sql.logLevel=INFO -Dliquibase.logLevel=INFO"
LIQUIBASE_SQL_LOG_LEVEL=INFO and LIQUIBASE_LOG_LEVEL=INFO
--sql-log-level=INFO --log-level=INFO
liquibase.sql.logLevel=INFO and liquibase.logLevel=INFO
Output
The following examples show the Liquibase logs of when you try to create the same table twice:
[2024-05-30 14:15:08] FINE [liquibase.integration] Performance monitoring disabled
[2024-05-30 14:15:08] INFO [liquibase.integration] Starting command execution.
[2024-05-30 14:15:08] FINE [liquibase.command] Found ProUpdateCommandStep override for UpdateCommandStep! Using ProUpdateCommandStep in pipeline.
[2024-05-30 14:15:08] FINE [liquibase.command] Found ProChangeExecListenerCommandStep override for ChangeExecListenerCommandStep! Using ProChangeExecListenerCommandStep in pipeline.
[2024-05-30 14:15:08] FINE [liquibase.command] Found ProChangeExecListenerCommandStep override for ChangeExecListenerCommandStep! Using ProChangeExecListenerCommandStep in pipeline.
[2024-05-30 14:15:08] FINE [liquibase.configuration] No configuration value for liquibase.outputFile found
[2024-05-30 14:15:08] FINE [liquibase.servicelocator] Loaded liquibase.io.OutputFileHandler instance liquibase.io.StandardOutputFileHandler
[2024-05-30 14:15:08] FINE [liquibase.servicelocator] Loaded liquibase.io.OutputFileHandler instance com.datical.liquibase.ext.io.ProOutputFileHandler
[2024-05-30 14:15:08] FINE [liquibase.configuration] No configuration value for liquibase.strict found
[2024-05-30 14:15:08] FINE [liquibase.configuration] Configuration liquibase.strict is using the default value of false
[2024-05-30 14:15:08] WARNING [liquibase.configuration] Potentially ignored key(s) in file exists at path liquibase.properties
(...)
[2024-05-30 14:15:08] INFO [liquibase.ui] Running Changeset: changelog.xml::2::nvoxland
[2024-05-30 14:15:08] FINE [liquibase.changelog] Running Changeset: changelog.xml::2::nvoxland
[2024-05-30 14:15:08] FINE [liquibase.executor] Changeset changelog.xml::2::nvoxland
[2024-05-30 14:15:08] FINE [liquibase.changelog] Reading ChangeSet: changelog.xml::2::nvoxland
[2024-05-30 14:15:08] FINE [liquibase.executor] Executing Statement: liquibase.statement.core.CreateTableStatement@5ebffb44
[2024-05-30 14:15:08] FINE [liquibase.executor] CREATE TABLE PUBLIC.person (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, firstname VARCHAR(50), lastname VARCHAR(50) NOT NULL, state CHAR(2), CONSTRAINT PK_PERSON PRIMARY KEY (id))
[2024-05-30 14:15:08] SEVERE [liquibase.changelog] ChangeSet changelog.xml::2::nvoxland encountered an exception.
[2024-05-30 14:15:56] INFO [liquibase.integration] Starting command execution.
[2024-05-30 14:15:56] WARNING [liquibase.configuration] Potentially ignored key(s) in file exists at path liquibase.properties
- 'sqlLogLevel'
[2024-05-30 14:15:56] INFO [liquibase.database] Set default schema name to PUBLIC
[2024-05-30 14:15:56] INFO [liquibase.changelog] Reading from PUBLIC.DATABASECHANGELOG
[2024-05-30 14:15:56] INFO [liquibase.lockservice] Successfully acquired change log lock
[2024-05-30 14:15:56] INFO [liquibase.command] Using deploymentId: 7089356978
[2024-05-30 14:15:56] INFO [liquibase.changelog] Reading from PUBLIC.DATABASECHANGELOG
[2024-05-30 14:15:56] INFO [liquibase.ui] Running Changeset: changelog.xml::2::nvoxland
[2024-05-30 14:15:57] SEVERE [liquibase.changelog] ChangeSet changelog.xml::2::nvoxland encountered an exception.
[2024-05-30 14:16:23] WARNING [liquibase.configuration] Potentially ignored key(s) in file exists at path liquibase.properties
- 'sqlLogLevel'
[2024-05-30 14:16:23] SEVERE [liquibase.changelog] ChangeSet changelog.xml::2::nvoxland encountered an exception.
liquibase.exception.DatabaseException: Table "PERSON" already exists;
[2024-05-30 14:17:01] SEVERE [liquibase.changelog] ChangeSet changelog.xml::2::nvoxland encountered an exception.