How to show an executed SQL for a changelog?

Hi,

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,
Vitaliy S

Okay, so here it goes:


  1. You need to have an instance of Database:


}


This is implemented in Clj-Liquibase here:

https://bitbucket.org/kumarshantanu/clj-liquibase/src/477a37749fb5/src/main/clj/org/bituf/clj_liquibase.clj#cl-410


Hope that helps.


Regards,

Shantanu

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 :slight_smile:

Regards,
Vitaliy S

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.


Regards,

Shantanu

Hi all,


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

class.


I extended the SpringLiquibase class and overwritten the afterPropertiesSet() method. Here is how:


  1. @Override
  2. kumar.shantanu's comment (thanks for it)!


    Hope this helps,

    dave00