指定配置
给类路径下放上每个日志框架自己的配置文件即可,springboot就不使用他默认的配置了:规则如下
logback.xml:直接就被日志框架识别了。
logback-spring.xml:日志框架不直接加载日志的配置项,由springboot解析日志配置,可以使用springboot的高级profile功能。可以指定某段配置只在某个环境下生效。(推荐使用xxx-spring.xml)
<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>
(类似于if条件判断写在xml里面吧)