0

版本:jboss-eap-7.2.4

这是用于日志记录的standalone.xml 配置部分,基本上有两个大小的旋转文件处理程序作为异步处理程序的子处理程序。

 <subsystem xmlns="urn:jboss:domain:logging:6.0">
        <async-handler name="ASYNC">
            <queue-length value="8192"/>
            <overflow-action value="block"/>
            <subhandlers>
                <handler name="FILE"/>
                <handler name="MetricLogger"/>
            </subhandlers>
        </async-handler>

        <size-rotating-file-handler name="FILE" autoflush="true">
          <filter-spec value="not(match(&quot;application-metrics.*&quot;))"/>
          <formatter>
             <pattern-formatter pattern="%d{dd MMM yyyy HH:mm:ss,SSS} %5p [CMS] [%t] %C{1}.%M() - %m%n"/>
          </formatter>
          <file path="/opt/application/log/application.log"/>
          <rotate-size value="10m"/>
          <max-backup-index value="100"/>
          <append value="true"/>
       </size-rotating-file-handler>
       <size-rotating-file-handler name="MetricLogger" autoflush="true">
         <filter-spec value="all(match(&quot;application-metrics.*&quot;))"/>
        <formatter>
           <pattern-formatter pattern="%d{dd MMM yyyy HH:mm:ss,SSS} %5p [METRICS] - %m%n"/>
        </formatter>
        <file path="/opt/application/log/application-metrics.log"/>
        <rotate-size value="10m"/>
        <max-backup-index value="10"/>
        <append value="true"/>
      </size-rotating-file-handler>

一开始它可以成功运行,并且可以将日志打印到文件中,但是运行一段时间后,它会抛出异常并且jboss会退出......

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.rollback(AbstractPropertyConfiguration.java:244)
        at org.jboss.logmanager.config.LogContextConfigurationImpl.doForget(LogContextConfigurationImpl.java:355)
        at org.jboss.logmanager.config.LogContextConfigurationImpl.forget(LogContextConfigurationImpl.java:319)
        at org.jboss.as.logging.logmanager.ConfigurationPersistence.forget(ConfigurationPersistence.java:341)
        at org.jboss.as.logging.logmanager.ConfigurationPersistence.rollback(ConfigurationPersistence.java:349)
        at org.jboss.as.logging.LoggingOperations$CommitOperationStepHandler$1.handleResult(LoggingOperations.java:122)
        at org.jboss.as.controller.AbstractOperationContext$Step.invokeResultHandler(AbstractOperationContext.java:1533)
        at org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1515)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1472)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1455)
        at org.jboss.as.controller.AbstractOperationContext$Step.access$400(AbstractOperationContext.java:1319)
        at org.jboss.as.controller.AbstractOperationContext.executeResultHandlerPhase(AbstractOperationContext.java:876)
        at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:726)
        at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:467)
        at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1411)
        at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:521)
        at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:470)
        at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:432)
        at org.jboss.as.server.ServerService.boot(ServerService.java:427)
        at org.jboss.as.server.ServerService.boot(ServerService.java:386)
        at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:372)
        at java.lang.Thread.run(Thread.java:748)
 
 Caused by: java.lang.NullPointerException: overflowAction is null
         at org.jboss.logmanager.handlers.AsyncHandler.setOverflowAction(AsyncHandler.java:117)
         ... 26 more No property "queueLength" type could be determined for handler "ASYNC"
4

1 回答 1

0

升级到 Wildfly 18 后,我们的团队也遇到了同样的问题(我们落后了很多版本,很难说到底是哪个版本导致的)。

我们的解决方案是确保根据我们的standalone.xml 正确生成 logging.properties 文件,因为这是一种备用日志配置,直到子系统在启动期间启动。

在执行standalone.sh/bat 时依次生成。我们仍然有一些悬而未决的问题:

  1. 为什么现在有这个要求?我们以前从未填充过 logging.properties 文件。
  2. 确切地说,standalone.sh 脚本的哪一步触发了 logging.properties 文件的生成。这是我们目前正在评估将其纳入我们的自定义启动过程的内容。
于 2021-01-25T16:24:32.383 回答