Logback错误:[标记名称]没有适用的操作,当前ElementPath是[标记路径]

时间:2019-05-17 07:00:55

标签: java logback

在JBoss中部署我的战争时,错误发生在logback配置XML中,并且部署失败

我在Spring Boot应用程序中使用logback.xml,因为我不能使用单独的logback-spring.xml,因为还有其他应用程序不能使用logback-spring.xml。当我包含[maxHistor]或[totalSizeCap]标签时,出现类似错误

no applicable action for [maxHistory], current ElementPath  is [[configuration][appender][rollingPolicy][timeBasedFileNamingAndTriggeringPolicy][maxHistory]]
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml" />
    <property name="NIF_LOG_HOME" value="/tpv/apps/jboss/jboss-eap-7.1/app_logs/NIF"/>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>%d ${APP_NAME} %-5level [%thread] %logger: %msg%n</Pattern>
        </layout>
    </appender>

    <appender name="NIF-AUDIT"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${NIF_LOG_HOME}/nif.log</file>

        <rollingPolicy
                class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- rollover daily -->
            <fileNamePattern>${NIF_LOG_HOME}/archived/nif.archived.%d{yyyy-MM-dd}.%i.log.gz
            </fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>100MB</maxFileSize>
                <maxHistory>20</maxHistory>
                <totalSizeCap>2GB</totalSizeCap>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>

        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
            </Pattern>
        </encoder>
    </appender>

    <root level="info">
        <appender-ref ref="STDOUT"/>
    </root>
    <logger name="com.tmna.toms.nif" additivity="false" level="debug">
        <appender-ref ref="NIF-AUDIT"/>
        <appender-ref ref="STDOUT"/>
    </logger>

</configuration>

我希望战争能够展开,但这不是因为以下错误

java.lang.IllegalStateException: Logback configuration error detected: 
00:53:23,304 INFO  [stdout] (ServerService Thread Pool -- 170) ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:29 - no applicable action for [maxHistory], current ElementPath  is [[configuration][appender][rollingPolicy][timeBasedFileNamingAndTriggeringPolicy][maxHistory]]
00:53:23,304 INFO  [stdout] (ServerService Thread Pool -- 170)  at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:161)

0 个答案:

没有答案