Skip to content

Commit

Permalink
Feat: Hibernate 로그 레벨 설정 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
WonSteps authored Sep 28, 2024
1 parent 67c861a commit fb22830
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ spring:
jpa:
hibernate:
ddl-auto: validate
show-sql: true
show-sql: false
open-in-view: false
defer-datasource-initialization: false

properties:
hibernate:
format_sql: true
highlight_sql: true
generate_statistics: true
session.events.log.LOG_QUERIES_SLOWER_THAN_MS: 300

datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}
Expand All @@ -23,6 +30,13 @@ spring:
virtual:
enabled: false

logging:
level:
org.hibernate.SQL: DEBUG
org.hibernate.orm.jdbc.bind: TRACE
org.hibernate.SQL_SLOW: INFO
org.hibernate.stat: DEBUG

server:
tomcat:
mbeanregistry:
Expand Down Expand Up @@ -69,4 +83,10 @@ management:
spring.config.activate.on-profile: local

---

logging:
level:
org.hibernate: ERROR
org.hibernate.SQL_SLOW: WARN

spring.config.activate.on-profile: prod
15 changes: 14 additions & 1 deletion src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ spring:
jpa:
hibernate:
ddl-auto: validate
show-sql: true
show-sql: false
open-in-view: false
defer-datasource-initialization: false

properties:
hibernate:
format_sql: true
generate_statistics: true
session.events.log.LOG_QUERIES_SLOWER_THAN_MS: 300

datasource:
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver

Expand All @@ -18,6 +24,13 @@ spring:
virtual:
enabled: false

logging:
level:
org.hibernate.SQL: DEBUG
org.hibernate.orm.jdbc.bind: TRACE
org.hibernate.SQL_SLOW: INFO
org.hibernate.stat: DEBUG

app:
api:
allow-origins: "*"
Expand Down

0 comments on commit fb22830

Please sign in to comment.