gpt4 book ai didi

java - 无法关闭/限制 ApacheDS 类之一的日志记录

转载 作者:行者123 更新时间:2023-11-30 07:11:01 25 4
gpt4 key购买 nike

我使用以下 log4j2 配置将 ApacheDS 类之一的日志记录限制为 ERROR 及更少。

<logger level="error" name="org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex">
<appender-ref ref="ARTFile" />
</logger>

来自该特定类的消息仍在调试级别进行记录。以下包的类似设置有效。

org.apache.directory.server.core

请帮忙。

这是完整的配置。

<?xml version="1.0" encoding="UTF-8"?>
<configuration name="defaultConfiguration" strict="true" monitorInterval="5">
<properties>
<property name="patternlayout">%-5p %d{ISO8601} [%t][%4C][%L] - %m%n</property>
<property name="filename">C:\\Releases\\RCL\\RLKSAdmin\\work\\rcladmin\\logs\\RLKS_ART.log</property>
<property name="filenamePattern">C:\\Releases\\RCL\\RLKSAdmin\\work\\rcladmin\\logs\\RLKS_ART_%i.log</property>
</properties>
<appenders>
<RollingFile name="ARTFile" fileName="${filename}" filePattern="${filenamePattern}" append="true">
<PatternLayout pattern="${patternlayout}" charset="UTF-8" />
<Policies>
<SizeBasedTriggeringPolicy size="3 MB" />
</Policies>
<DefaultRolloverStrategy max="5" />
</RollingFile>
</appenders>
<loggers>
<root level="trace">
<appender-ref ref="ARTFile" />
</root>
<logger level="error" name="org.springframework.core">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.beans">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.context">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.web">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.security">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.ldap">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.jndi">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.validation">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.ui">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.springframework.util">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.apache.directory.server.schema">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex"/>
<logger level="error" name="org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmTable"/>
<logger level="error" name="org.apache.directory.server.core">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.apache.directory.server.core.partition">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.apache.directory.server.protocol">
<appender-ref ref="ARTFile" />
</logger>
<logger level="error" name="org.apache.directory.shared">
<appender-ref ref="ARTFile" />
</logger>
</loggers>
</configuration>

最佳答案

如果您的目标是限制日志级别,最好不要指定appender-ref:这样限制适用于根记录器和所有关联的appender。在您显示的配置片段中,限制仅适用于“ARTFile”附加程序。

关于java - 无法关闭/限制 ApacheDS 类之一的日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39248627/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com