logging - 如何使用 logback API 在 logback 配置中添加或删除记录器
问题描述
目的是启用配置的动态重新加载。我知道改变水平是可能的。
但是,我在这里找不到任何用于添加或删除记录器的方法LoggerContext 。
例如,在下面的 logback 配置文件中,如果我想使用 API 添加名为“chapters.configuration”的记录器,我该怎么做?
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="chapters.configuration" level="INFO"/>
<!-- Strictly speaking, the level attribute is not necessary since -->
<!-- the level of the root level is set to DEBUG by default. -->
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
解决方案
推荐阅读
- ms-access - 在 MS Access 中使用 SQL 计算多样性指数
- regex - 正则表达式将所有单词截断为最大单词长度?
- javascript - React Native Map View 初始渲染
- python - 如何将 L1 正则化添加到 PyTorch NN 模型?
- vba - 登录后的Http post请求
- c# - C# 数学库(System.Numerics 与 Math.NET)
- asp.net-mvc - 使用 EF Core 3 进行 ASP.NET Core 3 远程验证
- c - C程序不会正确划分两个scanf输入
- javascript - 如何检查用户是否选择了一个属性
- cassandra - Cassandra 列名抽象,22 或 220 个列名。后果是什么?