# View actual SQL?

**URL:** <https://forum.liquibase.org/t/view-actual-sql/800>\
**Category:** General Discussion\
**Created:** [September 14, 2010, 2:01pm UTC](https://forum.liquibase.org/t/view-actual-sql/800 "2010-09-14T14:01:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![evan.leonard](https://avatars.discourse-cdn.com/v4/letter/e/6a8cbe/32.png) [@evan.leonard](https://forum.liquibase.org/u/evan.leonard)\
**Post date:** [September 14, 2010, 2:01pm UTC](https://forum.liquibase.org/t/view-actual-sql/800/1 "2010-09-14T14:01:00Z")

</div>

I’m sure there’s got to be an easy way to do this, but I couldn’t find it in the docs for the life of me.

How do I output/log the actual SQL statements that Liquibase generates and runs against the db?

Thanks,  
Evan

---

<div class="post-metadata">

**Author:** ![evan.leonard](https://avatars.discourse-cdn.com/v4/letter/e/6a8cbe/32.png) [@evan.leonard](https://forum.liquibase.org/u/evan.leonard)\
**Post date:** [September 14, 2010, 2:01pm UTC](https://forum.liquibase.org/t/view-actual-sql/800/2 "2010-09-14T14:01:00Z")

</div>

Well, I worked around this with this for now:

public void printSql()  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; try {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Connection c = getDataSource().getConnection();  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Liquibase liquibase = createLiquibase©;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PrintWriter pw = new PrintWriter(System.out);  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liquibase.update(getContexts(), pw);  
&nbsp; &nbsp; &nbsp; &nbsp; } catch (SQLException e) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();  
&nbsp; &nbsp; &nbsp; &nbsp; } catch (LiquibaseException e) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();  
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; }

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [September 14, 2010, 2:01pm UTC](https://forum.liquibase.org/t/view-actual-sql/800/3 "2010-09-14T14:01:00Z")

</div>

Instead of running “update” you can also run “updateSQL” which will output the SQL to be executed.&nbsp; You can also use --logLevel=DEBUG when you run update and it should output the SQL as part of the debug log.

Nathan
