2016-10-17 2 views

답변

0

스프링 부트 참조 내에서 Logging 섹션을 읽는 것이 좋습니다. 당신은 정말로 특정 환경에 맞는 애플리케이션을 구축해서는 안됩니다. 동일한 이슈를 사용하고 환경 변수를 지정하여 해당 환경의 고유 한 특성을 지정해야합니다 (The Twelve-Factor App - Build, Release, Run). 이 경우 하나의 응용 프로그램을 작성한 다음 local, dev 또는 prod를 사용할 때 spring.profiles.active 특성을 지정하는 것과 유사한 다른 log4j.properties 파일을 가리키는 logging.config에 대한 환경 변수를 지정할 수 있습니다.

프로필별로 로깅을 수행하는 Logback 참조에 특별한 섹션이 있습니다. 나는 원래의 질문은 log4j.properties를 말했지만 어쩌면 이것은 logback을 살펴 보는 데 필요할지도 모른다. Profile-Specific Configuration에 대한 섹션에서 logging.config 파일을 다양한 프로필의 섹션으로 사용자 지정할 수 있음을 보여줍니다. 예 :

<springProfile name="staging"> 
    <!-- configuration to be enabled when the "staging" profile is active --> 
</springProfile> 

<springProfile name="dev, staging"> 
    <!-- configuration to be enabled when the "dev" or "staging" profiles are active --> 
</springProfile> 

<springProfile name="!production"> 
    <!-- configuration to be enabled when the "production" profile is not active --> 
</springProfile> 
관련 문제