即使正确“导入”,也找不到Appender

时间:2019-04-11 18:52:03

标签: logging log4j2 fluentd

我正在尝试使用自定义Log4j2-Fluency附加程序。但是,当我启动应用程序时,出现以下错误

已经将包添加到配置部分,并且我正在使用原始Github存储库使用的相同log4j2.xml。我也有一个.conf文件,将.jars添加到类路径中,并为此附加程序添加了.jar。 https://github.com/wycore/log4j-plugin-fluency

启动应用程序时出现错误:

wrapper  | --> Wrapper Started as Console
wrapper  | Java Service Wrapper Community Edition 32-bit 3.3.9
wrapper  |   Copyright (C) 1999-2009 Tanuki Software, Ltd.  All Rights Reserved.

wrapper  |     http://wrapper.tanukisoftware.org
wrapper  |
wrapper  | Launching a JVM...
jvm 1    | WrapperManager: Initializing...
jvm 1    | 2019-04-11 11:46:26,738 ERROR Appenders contains an invalid element or attribute "Fluency"
jvm 1    | 2019-04-11 11:46:26,752 ERROR Unable to locate appender fluency for logger

log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.wywy.log4j.appender">
    <Appenders>
        <Fluency name="fluency" tag="yourTag">
            <!-- all settings are optional, see defaultFluency() for default values -->
            <!-- you can add as may fields as you like (or none at all) -->
            <StaticField name="application">yourApplication</StaticField>
            <StaticField name="someOtherField">some value</StaticField>
            <Server host="primary-node" port="24224"/>
            <Server host="secondary-node" port="24224"/>
            <FluencyConfig
              ackResponseMode="true"
              fileBackupDir="/tmp/fluency"
              bufferChunkInitialSize="4194304"
              bufferChunkRetentionSize="16777216"
              maxBufferSize="268435456"
              waitUntilBufferFlushed="30"
              waitUntilFlusherTerminated="40"
              flushIntervalMillis="200"
              senderMaxRetryCount="12" />
        </Fluency>
    </Appenders>
    <Loggers>
        <root level="info"> <!-- We log everything -->
            <appender-ref ref="fluency"/>
        </root>
    </Loggers>
</Configuration>

打开应用程序后,我希望它开始发送日志。 OBS:我发布了原始代码,但显然我用IP,Port更改了我的代码,而且我的Td-Agent / Fluentd配置正确。

0 个答案:

没有答案