반응형
반응형
반응형

 

Spring Boot 사용시 logback 설정에 대한 우선 순위를 알아봅니다.

 

 

Spring Properties 파일에 정의

 - application.properties

logging.level.org.springframework.boot.autoconfigure=DEBUG

 

 

Jar 실행 시 환경 변수로 정의

 - logback.xml

<logger name="org.springframework.boot.autoconfigure"><level value="INFO" /></logger>

 

우선 순위

 - Spring Properties 에서 설정한 내용이 우선 순위가 높습니다.

 - 그러나 logback.xml 에서는 실시간 변경등 작업을 할 수 있습니다.

 

 

반응형

'프로그래밍 > Spring' 카테고리의 다른 글

Spring Properties 파일 로딩 우선 순위  (1) 2023.01.04
반응형




Spring Properties 파일 로딩 우선 순위
 - 1이 가장 높음


# ############################ #
# 파일 위치(디렉토리) 우선 순위 설정.
# ############################ #


# default
1. file:./config/
2. file:./
3. classpath:/config/
4. classpath:/


# spring.config.additional-location
# - 기본 spring.config.location 에 추가.
ex) spring.config.additional-location=classpath:/custom-config/,file:./custom-config/
1. file:./custom-config/
2. classpath:custom-config/
3. file:./config/
4. file:./
5. classpath:/config/
6. classpath:/


# spring.config.location(기본값 : classpath:/,classpath:/config/,file:./,file:./config/)
# - 나중에 기술된 위치가 우선 순위가 높음.
# - 디렉토리 / 파일명 모두 명시 가능
# - 디렉토리를 명시 했을 경우 profile 설정 사용 가능.
ex) spring.config.location=classpath:/custom-config/,file:./custom-config/
1. file:./custom-config/
2. classpath:custom-config/



# ############################ #
# 파일명(profiile) 우선 순위 설정.
# ############################ #


# spring.profiles.active 설정.
# - 나중에 기술된 profile(dev) 이 우선순위가 높음.
ex) spring.profiles.active=common,dev
1. application-dev.properties
2. application-common.properties
3. application.properties


# spring.profiles.include 설정.
# - include 된 profile 이 우선순위가 높음.
ex) application.properties 파일 내용(spring.profiles.include=common)
1. application-common.properties
2. application.properties

 

# spring.profiles.active & spring.profiles.include 설정.
# - spring.profiles.active 의 profile 이 우선순위가 높음.
ex) spring.profiles.active=dev

ex) spring.profiles.include=common
1. application-dev.properties
2. application-common.properties
3. application.properties

 

 

# 환경 변수 -Dspring.profiles.active=prd

# vs

# 프로퍼티 spring.profiles.active=dev(application.properties 파일 내용)

# 환경변수의 profile 이 적용된다.

1. application-prd.properties
2. application.properties

 

 

반응형

'프로그래밍 > Spring' 카테고리의 다른 글

Spring logback 설정 우선 순위  (0) 2023.06.09

+ Recent posts