I have logback.xml
像这样:
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="2 seconds">
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<jmxConfigurator/>
<logger name="org.springframework" level="INFO"/>
<logger name="org.springframework.web.filter.CommonsRequestLoggingFilter" level="DEBUG"/>
<logger name="com.mypackage" level="WARN"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<turboFilter class="ch.qos.logback.classic.turbo.DynamicThresholdFilter">
<Key>dynamicLogLevel</Key>
<DefaultThreshold>DEBUG</DefaultThreshold>
<MDCValueLevelPair>
<value>dynamicLogLevelDEBUG</value>
<level>DEBUG</level>
</MDCValueLevelPair>
<!-- dynamicLogLevelERROR for testing -->
<MDCValueLevelPair>
<value>dynamicLogLevelERROR</value>
<level>ERROR</level>
</MDCValueLevelPair>
</turboFilter>
.....
</configuration>
我想设置记录器级别、附加程序、滚动策略logback.xml
in application.yaml
.
我经历过这个Doc https://springframework.guru/using-yaml-in-spring-boot-to-configure-logback/但没有找到足够的信息。
我在用着spring-boot 1.4.4-RELEASE
.
The springProperty
标签可能就是您所需要的。 Spring Boot会自动过滤source
属性,并将占位符替换为属性中的相应值。
<configuration scan="true" scanPeriod="2 seconds">
<springProperty name="yourVar" source="key.of.your.yaml.property"/>
...${yourVar}...
你可以看到GitHub 存储库中的详细信息 https://github.com/spring-projects/spring-boot/commit/055ace37f006120b0006956b03c7f358d5f3729f.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)