0
我正在嘗試像下面那樣配置logback,但它會引發此錯誤。配置文件如下:Logback文件錯誤:[配置]沒有適用的操作,當前的ElementPath是[[配置] [配置]]
<?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 [email protected]:42 - no applicable action for [configuration], current ElementPath is [[configuration][configuration]]
16:56:48,212 |-ERROR in [email protected]:74 - no applicable action for [appender], current ElementPath is [[configuration][configuration][appender]]
16:56:48,213 |-ERROR in [email protected]:18 - no applicable action for [encoder], current ElementPath is [[configuration][configuration][appender][encoder]]
16:56:48,213 |-ERROR in [email protected]:22 - no applicable action for [pattern], current ElementPath is [[configuration][configuration][appender][encoder][pattern]]
我衝浪了通過stackoverflow並糾正了一些錯誤。但它仍然不起作用。請幫忙!!
什麼選項,以啓動你的java程序? – NAIT
是你的整個logback.xml嗎?文件中沒有根標籤「配置」? – sheltem