gpt4 book ai didi

logging - Logback 文件错误 : no applicable action for [configuration], 当前 ElementPath 是 [[configuration][configuration]]

转载 作者:行者123 更新时间:2023-12-04 01:56:29 34 4
gpt4 key购买 nike

我正在尝试按如下方式配置 logback,但它抛出了这个错误。配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{ISO8601} %-5p [%c] %msg%n</pattern>
</encoder>
</appender>

<appender name="mediator" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<file>logs/mediator/cbs_mediator_rapid.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/mediator/cbs_mediator_rapid_%d{yyyyMMdd}_%d{HHmmss,aux}_%i.log</fileNamePattern>
<TimeBasedFileNamingAndTriggeringPolicy class="com.bosch.cbs.util.log.StartupSizeAndTimeBasedFNATP">
<maxFileSize>250MB</maxFileSize>
</TimeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<charset>utf-8</charset>
<pattern>%d{ISO8601} %-5p [%c] %msg%n</pattern>
</encoder>
</appender>

<appender name="activemq" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<file>logs/activemq/cbs_mediator_rapid_activemq.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/activemq/cbs_mediator_rapid_activemq_%d{yyyyMMdd}_%d{HHmmss,aux}_%i.log</fileNamePattern>
<TimeBasedFileNamingAndTriggeringPolicy class="com.bosch.cbs.util.log.StartupSizeAndTimeBasedFNATP">
<maxFileSize>250MB</maxFileSize>
</TimeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<charset>utf-8</charset>
<pattern>%d{ISO8601} %-5p [%c] %msg%n</pattern>
</encoder>
</appender>

<logger name="com.bosch.cbs.mediator" level="INFO" additivity="false">
<appender-ref ref="mediator" />
</logger>

<logger name="org.apache.activemq" level="INFO" additivity="false">
<appender-ref ref="activemq" />
</logger>

<logger name="org.apache.activemq.spring" level="WARN" additivity="false">
<appender-ref ref="activemq" />
</logger>

<root level="INFO">
<appender-ref ref="mediator" />
</root>

- - - 很快 - - -

我收到以下错误。
16:56:48,212 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@2:42 - no applicable action for [configuration], current ElementPath  is [[configuration][configuration]]
16:56:48,212 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:74 - no applicable action for [appender], current ElementPath is [[configuration][configuration][appender]]
16:56:48,213 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:18 - no applicable action for [encoder], current ElementPath is [[configuration][configuration][appender][encoder]]
16:56:48,213 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:22 - no applicable action for [pattern], current ElementPath is [[configuration][configuration][appender][encoder][pattern]]

我已经浏览过stackoverflow并纠正了一些错误。但它仍然不起作用。请帮忙!!

最佳答案

如果您使用的是 spring-boot,那么您必须使用。单独定义您的 logback 并包含它们。有关问题,请参阅 details
logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProfile name="staging, production">
<include resource="logback-production.xml"/>
</springProfile>

<springProfile name="dev">
<include resource="logback-dev.xml"/>
</springProfile>

</configuration>

https://github.com/spring-projects/spring-boot/issues/3503

关于logging - Logback 文件错误 : no applicable action for [configuration], 当前 ElementPath 是 [[configuration][configuration]],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35607031/

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