Show Hibernate/JPA SQL Statements from Spring Boot | Code Factory

1. Overview

2. Logging JPA Queries

2.1. To Standard Output

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

2.2. Via Loggers

logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

3. Logging JdbcTemplate Queries

logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG
logging.level.org.springframework.jdbc.core.StatementCreatorUtils=TRACE

4. How Does it Work?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store