Notice
I wrote this article and was originally published on Qiita on 18 September 2019.
Setup
I will show it by using my notice board example application (Spring Data JPA version). On file src/main/resources/application.properties, add following line
# if you set debug=true, no need to add first line
logging.level.org.hibernate.SQL=trace
logging.level.org.hibernate.type=trace
Start the application, you can see following log message on loading some page.
## SQL statement generated by JPA vendor library, "?" is place of parameter put into
2019-09-18 12:00:53.660 DEBUG 1436 --- [nio-8080-exec-4] org.hibernate.SQL : select message0_.id as id1_1_, message0_.approved_by as approved2_1_, message0_.approved_date as approved3_1_, message0_.description as descript4_1_, message0_.owner as owner5_1_, message0_.publish_date as publish_6_1_, message0_.remove_date as remove_d7_1_ from message message0_ where message0_.owner=? order by message0_.publish_date DESC
## first parameter bind into SQL statement
2019-09-18 12:00:53.660 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [VARCHAR] - [user1]
## 1st record returned
2019-09-18 12:00:53.661 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([id1_1_] : [BIGINT]) - [4]
2019-09-18 12:00:53.662 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([approved2_1_] : [VARCHAR]) - [null]
2019-09-18 12:00:53.662 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([approved3_1_] : [TIMESTAMP]) - [null]
2019-09-18 12:00:53.663 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([descript4_1_] : [VARCHAR]) - [Waiting approve message 1]
2019-09-18 12:00:53.663 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([owner5_1_] : [VARCHAR]) - [user1]
2019-09-18 12:00:53.663 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([publish_6_1_] : [TIMESTAMP]) - [2019-08-03T10:00]
2019-09-18 12:00:53.663 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([remove_d7_1_] : [TIMESTAMP]) - [null]
## 2nd record returned
2019-09-18 12:00:53.663 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([id1_1_] : [BIGINT]) - [5]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([approved2_1_] : [VARCHAR]) - [null]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([approved3_1_] : [TIMESTAMP]) - [null]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([descript4_1_] : [VARCHAR]) - [Waiting approve message 2]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([owner5_1_] : [VARCHAR]) - [user1]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([publish_6_1_] : [TIMESTAMP]) - [2019-08-03T10:00]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([remove_d7_1_] : [TIMESTAMP]) - [null]
## 3rd record returned
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([id1_1_] : [BIGINT]) - [1]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([approved2_1_] : [VARCHAR]) - [admin]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([approved3_1_] : [TIMESTAMP]) - [2019-07-31T21:00]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([descript4_1_] : [VARCHAR]) - [Hello world]
2019-09-18 12:00:53.664 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([owner5_1_] : [VARCHAR]) - [user1]
2019-09-18 12:00:53.665 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([publish_6_1_] : [TIMESTAMP]) - [2019-08-01T12:30]
2019-09-18 12:00:53.665 TRACE 1436 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([remove_d7_1_] : [TIMESTAMP]) - [null]
Top comments (0)