错误处理元素 GELF([Appenders:null]):CLASS_NOT_FOUND
Error processing element GELF ([Appenders: null]): CLASS_NOT_FOUND
我的 log4j2.xml 文件中出现以下错误:
Error processing element GELF ([Appenders: null]): CLASS_NOT_FOUND
一开始以为是引用了无效的appender,结果注释掉后还是报错。
这是我的资料:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" packages="org.graylog2.log4j2">
<Appenders>
<GELF name="gelfAppender"
server="org.graylog2.log.GelfAppender"
port="12201"
hostName="some.host"
facility="GELF-JAVA"
extractStacktrace="true"
addExtendedInformation="true">
<PatternLayout pattern="${some_pattern}"/>
<!-- Additional fields -->
<KeyValuePair key="someKey" value="someVal"/>
</GELF>
</Appenders>
原来我遗漏了几个依赖项;没有更多的错误! :D
就我而言,我在 pom.xml
中缺少此依赖项
<dependency>
<groupId>org.graylog2.log4j2</groupId>
<artifactId>log4j2-gelf</artifactId>
<version>1.3.1</version>
</dependency>
This文章对我帮助很大
我的 log4j2.xml 文件中出现以下错误:
Error processing element GELF ([Appenders: null]): CLASS_NOT_FOUND
一开始以为是引用了无效的appender,结果注释掉后还是报错。
这是我的资料:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" packages="org.graylog2.log4j2">
<Appenders>
<GELF name="gelfAppender"
server="org.graylog2.log.GelfAppender"
port="12201"
hostName="some.host"
facility="GELF-JAVA"
extractStacktrace="true"
addExtendedInformation="true">
<PatternLayout pattern="${some_pattern}"/>
<!-- Additional fields -->
<KeyValuePair key="someKey" value="someVal"/>
</GELF>
</Appenders>
原来我遗漏了几个依赖项;没有更多的错误! :D
就我而言,我在 pom.xml
中缺少此依赖项 <dependency>
<groupId>org.graylog2.log4j2</groupId>
<artifactId>log4j2-gelf</artifactId>
<version>1.3.1</version>
</dependency>
This文章对我帮助很大