使用带有Flume的Log4j2递归调用appender错误

使用带有Flume的Log4j2递归调用appender错误,log4j,flume,log4j2,Log4j,Flume,Log4j2,我将Log4j2与水槽附加器一起使用,配置如下: <?xml version="1.0" encoding="UTF-8"?> <configuration status="debug" name="ALI" packages=""> <appenders> <Flume name="eventLogger" suppressExceptions="false" compress="false"> <Agent hos

我将Log4j2与水槽附加器一起使用,配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug" name="ALI" packages="">
  <appenders>
    <Flume name="eventLogger" suppressExceptions="false" compress="false">
      <Agent host="localhost" port="4141"/>
      <RFC5424Layout enterpriseNumber="18060" includeMDC="true" appName="com.weather.ali"/>
    </Flume>
    <RollingFile name="VTECs" fileName="logs/vtecs.log"
                 filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
      <PatternLayout>
        <pattern>[%d{ISO8601}] %m%n</pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
        <SizeBasedTriggeringPolicy size="250 MB"/>
      </Policies>
    </RollingFile>
  </appenders>
  <loggers>
    <root level="debug">
      <appender-ref ref="eventLogger"/>
    </root>
    <logger name="VTEC" level="debug">
      <appender-ref ref="VTECs"/>
    </logger>
  </loggers>
</configuration>
所以有两个问题:

  • 为什么这在某些节点上有效而在其他节点上无效
  • 我已经查看了生成此错误的代码,每当appender代码被多次调用时,它似乎都会被调用。我看不出有什么理由这样做。有人能给我解释一下吗

  • 结果证明(毫不奇怪)这是受影响节点上的水槽配置问题。这些节点上的Flume代理没有正确启动,这导致了相当神秘的递归错误。

    FYI,对于其他跟踪类似log4j递归警告的用户:

    2013-05-07 09:21:59,033 DEBUG Calling createAgent on class org.apache.logging.log4j.flume.appender.Agent for element Agent with params(host="localhost", port="4141")
    2013-05-07 09:21:59,040 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.RFC5424Layout for element RFC5424Layout with params(facility="null", id="null", enterpriseNumber="18060", includeMDC="true", mdcId="null", mdcPrefix="null", eventPrefix="null", newLine="null", newLineEscape="null", appName="com.weather.ali", messageId="null", mdcExcludes="null", mdcIncludes="null", mdcRequired="null", charset="null", exceptionPattern="null", Configuration(MyApp))
    2013-05-07 09:22:02,148 DEBUG Generated plugins in 3.106963125 seconds
    2013-05-07 09:22:02,156 DEBUG Calling createAppender on class org.apache.logging.log4j.flume.appender.FlumeAppender for element Flume with params(agents={host=localhost port=4141}, properties={}, embedded="null", type="null", dataDir="null", connectTimeout="null", requestTimeout="null", agentRetries="null", maxDelay="null", name="eventLogger", suppressExceptions="false", mdcExcludes="null", mdcIncludes="null", mdcRequired="null", mdcPrefix="null", eventPrefix="null", compress="false", batchSize="null", null, RFC5424Layout(facility=LOCAL0 appName=com.weather.ali defaultId=Audit enterpriseNumber=18060 newLine=false includeMDC=true messageId=null), null)
    2013-05-07 09:22:02,159 DEBUG Starting FlumeAvroManager FlumeAvro[localhost:4141]
    2013-05-07 09:22:02,552 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={eventLogger})
    2013-05-07 09:22:06,774 DEBUG Generated plugins in 4.221008626 seconds
    2013-05-07 09:22:06,776 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="eventLogger", level="null", null)
    2013-05-07 09:22:06,778 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", includeLocation="null", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@55ed34f1}, properties={}, Configuration(MyApp), null)
    2013-05-07 09:22:06,779 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={root})
    2013-05-07 09:22:06,779 DEBUG Shutting down OutputStreamManager SYSTEM_OUT
    2013-05-07 09:22:06,779 DEBUG Reconfiguration completed
    2013-05-07 09:22:07,237 ERROR Recursive call to appender eventLogger