Spring Boot環境にHibernate JPAが作成したSQLステートメント出力する

# 設定する

僕の[サンプルアプリケーション(Spring Data JPAバージョン)](https://github.com/saladlam/spring-noticeboard/tree/spring-data-jpa)を使って、やり方を示す。ファイル**src/main/resources/application.properties**に、下のコードを入れる

```
# もしdebug=trueが設定したら、1行目が書かなくてもいい
logging.level.org.hibernate.SQL=trace

logging.level.org.hibernate.type=trace
```

アプリケーションを起動し、ウェブページにアクセスすると、以下のログ出力が見える。

```
## JPAベンダライブラリが作成したSQLステートメント。"?"は引数を入れ替える場所
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
## 1番目に指定した引数数
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]

## クエリ結果1行目
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]
## クエリ結果2行目
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]
## クエリ結果3行目
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]
```