On RC7 when I use a that has onFail=“HALT” and an onFailMessage, if the precondition fails, the log output doesn’t contain my onFailMessage.
This is awkward because my build team doesn’t understand why LB failed. In fact, the only way the log will give me any indication of which changeset it was on is if I enable debug-level logging.
Request: A precondition failure should always output the onFailMessage regardless of what onFail is set to. I should be able to see the onFailMessage without changing the logLevel from the default.
Could this be fixed?
Suggestion: Looks like a simple change in PreconditionContainer.java check(…) – would a LogFactory.getLogger().warning/info call for the HALT condition make sense? Or perhaps in ChangeSet.java execute(…)?
Precondition looks like:
<preConditions onFail="HALT" onFailMessage="Friendly Fail Message"> <sqlCheck expectedResult="purposely fail this">select 'abc'</sqlCheck> </preConditions>
Command-line output is:
Liquibase Update Failed: Preconditions Failed. For more information, use the --logLevel flag)
Debug-level log output is:
... liquibase:FINEST: Changeset <filename>.xml::1::<author>::(Checksum: 3:<checksum>) liquibase:FINEST: Executing QUERY database command: select 'abc' liquibase:FINEST: Release Database Lock liquibase:FINEST: Executing UPDATE database command: UPDATE [dbo].[DATABASECHANGELOGLOCK] SET [LOCKED] = 0, [LOCKEDBY] = NULL, [LOCKGRANTED] = NULL WHERE [ID] = 1 liquibase:INFO: Successfully released change log lock liquibase:INFO: Preconditions Failed
And that needs some training & time to understand that “the last change set mentioned in this very verbose log was x::y::z, and it turned out to be a precondition failure, therefore I have to look in the source to understand what a failure on precondition x::y::z means”, instead of “oh, the problem is due to !”
In constrast, if I use onFail=“CONTINUE”, the output is beautiful. Here is a sample, with the default logging level:
... liquibase:INFO: Continuing past: <filename>.xml::1::<author>::(Checksum: 3:<checksum>) despite precondition failure: Friendly Fail Message liquibase:INFO: ChangeSet parameter_verification.xml::1::clean ran successfully in 6ms ...
The onFailMessage is also listed when onFAIL=“MARK_RAN” or onFAIL=“WARN”
But I prefer halting in our environment.
A big thanks for all your work! I’m willing to test any fix