logback-spring.xml supports springProfile tag and Spring Boot recommends to use logback-spring.xml instead of logback.xml.
You can use springProfile tag in logback-spring.xml as follows:
<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>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…