- eclipseのコンソールにSQLのログを出力をしたい時に設定ファイルに以下を指定する。Springのバージョンは3
# SQLをログ出力
logging.level.org.hibernate.SQL=debug
# SQLのバインドパラメーターをログ出力
logging.level.org.hibernate.type=trace
logging.level.org.hibernate.orm.jdbc.bind=trace
# SELECT文の結果をログ出力
logging.level.org.hibernate.orm.jdbc.extract=trace
# SQL整形
spring.jpa.properties.hibernate.format_sql=true
2023-09-13T21:27:32.859+09:00[0;39m [32mDEBUG[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.SQL [0;39m [2m:[0;39m
select
e1_0.room_id,
e1_0.equipment_id,
e1_0.equipment_name
from
equipment e1_0
where
e1_0.room_id=?
[2m2023-09-13T21:27:32.861+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.bind [0;39m [2m:[0;39m binding parameter [1] as [INTEGER] - [1]
[2m2023-09-13T21:27:32.864+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.extract [0;39m [2m:[0;39m extracted value ([1] : [INTEGER]) - [1]
[2m2023-09-13T21:27:32.864+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.extract [0;39m [2m:[0;39m extracted value ([2] : [INTEGER]) - [1]
[2m2023-09-13T21:27:32.865+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.extract [0;39m [2m:[0;39m extracted value ([3] : [VARCHAR]) - [時計]
[2m2023-09-13T21:27:32.870+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.extract [0;39m [2m:[0;39m extracted value ([1] : [INTEGER]) - [1]
[2m2023-09-13T21:27:32.870+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.extract [0;39m [2m:[0;39m extracted value ([2] : [INTEGER]) - [3]
[2m2023-09-13T21:27:32.870+09:00[0;39m [32mTRACE[0;39m [35m60626[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36morg.hibernate.orm.jdbc.extract [0;39m [2m:[0;39m extracted value ([3] : [VARCHAR]) - [テレビ]
コメント