org.hibernate.sql 미작동

2024. 1. 9. 18:07·트러블슈팅
목차
  1. logging.level.org.hibernate.sql
  2. reference

 

로거를 통한 쿼리문 로깅을 위해 logging.level.org.hibernate.sql: debug 를 application.yaml에 작성해주었으나 제대로 작동하지 않는 것을 발견하였다. 

 

이 문제는 logging.level.org.hibernate.SQL: debug 와 같이 'sql'을 'SQL'로 작성해주면 해결된다.

 

logging.level.org.hibernate.sql

logging:
  level:
    org.hibernate.sql: debug
    org.hibernate.type: trace

🔼실행결과 쿼리문 확인 불가

logging:
  level:
    org.hibernate.SQL: debug
    org.hibernate.type: trace

🔼실행결과 정상적으로 출력된 쿼리문 확인

 

org.hibernate.SQL이 아닌 debug org.hibernate.sql을 작성했던 것이 문제였다.

내가 설정한 org.hibernate.sql은 패키지였다.

 

 

이걸 선택해야했었다.(애초에 대문자로 작성하자.)

 

 

 

logging.level.org.hibernate.SQL: debug

https://docs.spring.io/spring-boot/docs/3.1.7/reference/html/application-properties.html#appendix.application-properties

 

 : logging.level.* 형식을 통해 org.hibernate.SQL에 대한 로깅 레벨을 debug로 설정

 

spring.jpa.properties.hibernate.show_sql 설정과 비교

jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.MySQL8Dialect
        show_sql: true #A
        format_sql: true
        use_sql_comments: true
        hbm2ddl:
          auto: create
        default_batch_fetch_size: 1000
logging:
  level:
    org.hibernate.sql: debug #B

 

spring.jpa.properties.hibernate.show_sql: true 옵션을 A, logging.level.org.hibernate.sql: debug 옵션을 B라고 하자.

 

A는 하이버네이트 실행 SQL문을 시스템 출력하고 B는 logger를 통해 출력한다. 따라서 spring.jpa.properties.hibernate.show_sql: true은 끄고 logging.level.org.hibernate.sql: debug 옵션을 사용하는 것이 좋다.

 

reference

https://sematext.com/blog/logging-levels/

 

Logging Levels: What They Are & How to Choose Them - Sematext

Learn about the most common log levels and how they work. Best practices on when and how to use them to control log output and filter alerts.

sematext.com

 

 

'트러블슈팅' 카테고리의 다른 글

[Redis Error] Unable to send PING command over channel  (0) 2024.10.22
springboot Could not move temporary workspace 오류  (0) 2024.05.01
Git "There is no tracking information for the current branch. Please specify which branch you want to merge with. "오류  (0) 2024.01.09
git push author 변경  (0) 2023.09.04
400 에러 - 필드가 하나인 DTO의 기본 생성자 부재...  (0) 2023.08.22
  1. logging.level.org.hibernate.sql
  2. reference
'트러블슈팅' 카테고리의 다른 글
  • [Redis Error] Unable to send PING command over channel
  • springboot Could not move temporary workspace 오류
  • Git "There is no tracking information for the current branch. Please specify which branch you want to merge with. "오류
  • git push author 변경
용쓰개
용쓰개
  • 용쓰개
    용쓰게
    용쓰개
  • 전체
    오늘
    어제
    • 분류 전체보기 (34)
      • Spring (11)
        • 스프링 Data JPA (0)
        • 스프링 시큐리티 (1)
        • QueryDSL (1)
        • webflux (1)
      • JAVA (5)
      • 여러가지 모르는 지식들 (6)
      • 알고리즘 (0)
      • 후기 (0)
        • 일상 (1)
        • 책 (1)
      • 운영체제 (1)
      • 트러블슈팅 (9)
      • 프로젝트 (0)
        • 펫동네 (0)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
용쓰개
org.hibernate.sql 미작동

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.