当前位置: 首页 > 知识库问答 >
问题:

日志回退文件错误:没有适用的操作为[rolling政策],当前模式是[[配置][appender][rolling政策]]

章振
2023-03-14

我使用登录在akka写入日志文件每件事都很好,直到我的日志文件停止写入日志也许它变得完整,所以我阅读了滚动政策,所以我可以创建额外的文件,但我最终与很多错误这里是我的logback.xml文件

<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
  <File>/media/sara/682AA7A32AA76D2E/study/ifkaarproject/articateInScala/log/akka.log</File>
      <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>/media/sara/682AA7A32AA76D2E/study/ifkaarproject/articateInScala/log/akka.%i.log</fileNamePattern>
      <minIndex>1</minIndex>
      <maxIndex>3</maxIndex>
    </rollingPolicy>

   <triggeringPolicy class="com.bigbasket.dapp.utilities.SizeBasedTriggeringPolicy">
        <maxFileSize>5MB</maxFileSize>
    </triggeringPolicy>

     <encoder>
          <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %logger{0} %X{akkaSource} %msg%n</pattern>
         </encoder>
   </appender>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">

    <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{0} %X{akkaSource} -%msg%n</pattern>
    </encoder>

  </appender>

   <root level="info">
   <appender-ref ref="FILE" />
    <appender-ref ref="STDOUT"/>

   </root>
</configuration>

当我在sbt中运行应用程序时,会打印出以下消息

15:29:30,350 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
15:29:30,350 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:29:30,351 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/media/sara/682AA7A32AA76D2E/study/ifkaarproject/articateInScala/target/scala-2.11/classes/logback.xml]
15:29:30,594 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:29:30,595 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender]
15:29:30,605 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
15:29:30,675 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:83 - no applicable action for [rollingPolicy], current pattern is [[configuration][appender][rollingPolicy]]
15:29:30,676 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:24 - no applicable action for [fileNamePattern], current pattern is [[configuration][appender][rollingPolicy][fileNamePattern]]
15:29:30,676 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:17 - no applicable action for [minIndex], current pattern is [[configuration][appender][rollingPolicy][minIndex]]
15:29:30,676 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:17 - no applicable action for [maxIndex], current pattern is [[configuration][appender][rollingPolicy][maxIndex]]
15:29:30,677 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@10:85 - no applicable action for [triggeringPolicy], current pattern is [[configuration][appender][triggeringPolicy]]
15:29:30,677 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@11:22 - no applicable action for [maxFileSize], current pattern is [[configuration][appender][triggeringPolicy][maxFileSize]]
15:29:30,678 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
15:29:30,728 |-INFO in ch.qos.logback.core.FileAppender[FILE] - File property is set to [/media/sara/682AA7A32AA76D2E/study/ifkaarproject/articateInScala/log/akka.log]
15:29:30,729 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
15:29:30,731 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
15:29:30,734 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
15:29:30,735 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
15:29:30,735 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
15:29:30,736 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
15:29:30,736 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
15:29:30,738 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6f2bba4f - Registering current configuration as safe fallback point

在此之前


共有2个答案

岳枫
2023-03-14

我在spring boot遇到了一个稍微不同的问题:

ERROR in ch.qos.logback.core.joran.spi.Interpreter@90:29 - no applicable action for [priority], current ElementPath  is [[configuration][root][priority]]

我在删除<代码>时修复了它

<root level="INFO">
        <appender-ref ref="stdout" />
        <appender-ref ref="file" />
         <priority level="INFO"/> // removed this line
    </root>
邵展
2023-03-14

您需要使用类型为 RollingFileAppender(而不是 FileAppender)的记录器,如下所示:

<configuration>
    <!-- this is the important line -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>/media/sara/682AA7A32AA76D2E/study/ifkaarproject/articateInScala/log/akka.log</File>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>/media/sara/682AA7A32AA76D2E/study/ifkaarproject/articateInScala/log/akka.%i.log</fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>3</maxIndex>
        </rollingPolicy>
        <triggeringPolicy class="com.bigbasket.dapp.utilities.SizeBasedTriggeringPolicy">
            <maxFileSize>5MB</maxFileSize>
        </triggeringPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %logger{0} %X{akkaSource} %msg%n</pattern>
        </encoder>
    </appender>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{0} %X{akkaSource} -%msg%n</pattern>
        </encoder>
    </appender>
    <root level="info">
        <appender-ref ref="FILE" />
        <appender-ref ref="STDOUT" />
    </root>
</configuration>
 类似资料:
  • 我正在尝试配置如下的日志,但是它抛出了这个错误。配置文件如下所示: -等等- 我收到以下错误。 我已经浏览了stackoverflow并纠正了其中的一些错误。但它仍然不起作用。请帮忙!!

  • 我有一个非常简单的Spring Boot1.2.2 web应用程序,我为它创建了一个logback.xml配置文件: 一切正常!以下是日志文件中的调试输出:

  • 实现滚动字幕的效果。 [Code4App.com]

  • 引言 小牛知识库(以下或称“我们”)非常重视您的隐私保护,您在使用我们的业务平台(xnip.cn)的产品和服务时,我们可能会收集和使用您的相关信息。我们希望通过本《隐私政策》向您说明,我们如何收集、使用、存储及共享您的个人信息,以及您如何访问、更新、控制和保护您的个人信息。 本《隐私政策》与您使用我们的服务关系紧密,希望您仔细阅读并理解,做出您认为适当的选择。您使用或继续使用我们的服务,即意味着您

  • 我有一条小路线,我想使用自定义的重新传递策略来重复向endpoint发送消息,但这种行为非常奇怪。看起来,重新交付政策只是在重复一个错误。我试图将所有交换发送到路由的开头,但策略不起作用,因为每次都在创建: 我做错了什么?当错误发生时,我想以间隔重复我的请求。我的骆驼版本是2.6 日志:

  • 我是单点登录 (SSO) 概念的新手。我开始知道 SAML 请求和响应是实现 SSO 过程的最佳方式。然后我开始阅读有关SAML2.0的内容。我在 saml2.0 中发现了一个术语 NameIdPolicy,这在 saml1.0 中是不存在的。 定义说这是我们从IdP请求的NameID的格式,我想知道该格式是什么?我的意思是来自IDP的哪些数据应该以NameIDPolicy指定的格式出现?任何人都