Spring Boot JPA - 쿼리 로그 나오게 설정하는 법

식빵·2025년 2월 25일
0

Spring Lab

목록 보기
35/35

계속 까먹어서 짜증나서 그냥 기록합니다.
아래 설정은 application.yaml 에 작성한 내용을 그대로 복붙한 겁니다.

spring:
  application:
    name: spring_jpa_practice
  datasource:
    username: postgres
    password: postgres
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://localhost:5432/postgres
  jpa:
    #hibernate:
    #  ddl-auto: none
    #open-in-view: false
    properties:
      show_sql: true
      hibernate:
        format_sql: true
        # default_batch_fetch_size: 1000
        use_sql_comments: true

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

# 혹시라도  jdbcTemplate 로그 보고 싶으면 아래처럼...
# logging.level.org.springframework.jdbc.core.JdbcTemplate: DEBUG
# logging.level.org.springframework.jdbc.core.StatementCreatorUtils: TRACE
  • 로그 설정과 별개인 것은 주석처리했습니다
profile
백엔드 개발자로 일하고 있는 식빵(🍞)입니다.

0개의 댓글

관련 채용 정보