4

I am getting the following error in my log4j2.xml file:

Error processing element GELF ([Appenders: null]): CLASS_NOT_FOUND

At first I thought it was because I was referencing an invalid appender, but I still have the error after commenting it out.

Here is what I have:

<?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>
Steve.NayLinAung
  • 5,086
  • 2
  • 25
  • 49
mr nooby noob
  • 1,860
  • 5
  • 33
  • 56

2 Answers2

1

In my case I was missing this dependency in the pom.xml

    <dependency>
        <groupId>org.graylog2.log4j2</groupId>
        <artifactId>log4j2-gelf</artifactId>
        <version>1.3.1</version>
    </dependency>

This article helped me a lot.

Azucena H
  • 108
  • 9
-1

It turned out I was missing a couple of dependencies; no more error! :D

mr nooby noob
  • 1,860
  • 5
  • 33
  • 56