I’m using Liquibase via Spring Integration.
How can I see an executed SQL for a changelog?
PS My goal is to see it in log4j, i tried adding loggers with debug verbosity but it didn’t help.
Thanks In Advance,
Okay, so here it goes:
- You need to have an instance of Database:
This is implemented in Clj-Liquibase here:
Hope that helps.
Thank you very much for reply.
I’ll what sort of programmatic access do I need?
I have a spring bean which liquibase provided, if needed I can subclass from it and perform all necessary steps, just need a hint where to dig
By using the Liquibase API you can generate the set of SQL statements that will be executed for a given change. This, however, requires programmatic access.
So as i came across the same problem i decided to share my solution (propably not the best).
As i’m also using the Spring integration i knew i have to ‘hook’ my code to print out the statements.
That is because the SpringLiquibase class is using the update(context) method from the Liquibase
I extended the SpringLiquibase class and overwritten the afterPropertiesSet() method. Here is how:
- kumar.shantanu's comment (thanks for it)!
Hope this helps,