Search code examples
mavenliquibaseliquibase-sql

Can a Maven Liquibase project print sql execution logs, e.g. "table created successfully"?


I have a client request for us to apply changes in our maven Liquibase project, so that we can see printed out the execution outputs of all plsql deployments, so we can observe what object has been created/modified. Basically something like:

[INFO] ------------------------------------------------------------------------ [INFO] Parsing Liquibase Properties File src/main/resources/liquibase.properties for changeLog parameters [INFO] Executing on Database: jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)...... [INFO] Successfully acquired change log lock [INFO] Reading from DATABASECHANGELOG [INFO] SQL in file src/main/resources/config/liquibase/release/owner/myschema/rollout/Tbl_creation_myschema.sql executed

Table myschema.TestTable created successfully

[INFO] ChangeSet src/main/resources/config/liquibase/release/owner/myschema/databaseChangeLog_myschema.xml::005-myschema_owner::myschema ran successfully in 134ms [INFO] Successfully released change log lock [INFO] ------------------------------------------------------------------------

Im not an expert on this, and have played around for quite a while now with logging levels, runWith commands, and all sort of properties, commands or dependencies explained in Liquibase or Maven documentation, but just cant find anything over the web including here, so starting to wonder if this is even possible!?

Thanks in advance,

pe500a


Solution

  • It seems that this is not reachable when using SQL-formatted scripts; if, instead, we use XML-format, then it prints the desired output:

    [INFO] Successfully acquired change log lock
    [INFO] Reading from DATABASECHANGELOG
    **[INFO] Table AP_Test_0000099999 created**
    [INFO] ChangeSet src/main/resources/config/liquibase/release/owner/my_schema/databaseChangeLog_my_schema.xml::025-my_schema::app_user ran successfully in 84ms
    **[INFO] Column AP_Test_0000099999.dept dropped**
    [INFO] ChangeSet src/main/resources/config/liquibase/release/owner/my_schema/databaseChangeLog_my_schema.xml::026-my_schema::app_user ran successfully in 98ms
    [INFO] Successfully released change log lock