Show SQL Statements in Spring Boot Logs

Spring Boot

This Java article explains how to show SQL statements or queries generated by JPA or Hibernate in the Spring Boot Application logs.

For logging SQL statements generated by Spring Data JPA / Hibernate, add below property to your configuration file.

To beautify or pretty print the SQL queries, you can add:

Here is the log output.

    select as id1_0_0_,
        product0_.description as descript2_0_0_,
        product0_.image_url as image_ur3_0_0_,
        product0_.price as price4_0_0_,
        product0_.product_id as product_5_0_0_,
        product0_.version as version6_0_0_
        product product0_
Share This Post On: