In this post, I am going to share how to show Hibernate SQL queries on the console log while running your Spring Boot project(s).
Enable Hibernate SQL Queries Logging
To show hibernate SQL queries in the Spring Boot log file you will need to update the
application.properties file with the following details:
Show SQL Values
Additionally, to logging Hibernate SQL Queries, you can make your Spring Boot show the values which are being used in the SQL query, update
application.properties file by adding the following line:
Show JPA SQL Queries
If you use Spring Data JPA then you can log SQL queries by updating your
application.properties file by adding:
Format Hibernate SQL Query
You can also make SQL queries display in your log file in a very friendly-to-read format. To format SQL queries add the following property to
Kuzu Zangpo la! I am Sonam Dargay. I am a full-time software developer. Apart from 9-5 office works, I am a tech enthusiast, blogger, and dreamer.
I graduated from the College of Science and Technology(CST), affiliated with the Royal University of Bhutan.