Getting Data In

Splunk Log4J2 Appender in Spring Boot with Maven

ssdarkside2
Explorer

I have a simple Maven configuration where I know the following is on the classpath (I can verify it at runtime before Spring Boot starts up in my application class):

com.splunk.logging:splunk-library-javalogging:1.6.2

The Maven dependency looks like:

<dependency>
  <groupId>com.splunk.logging</groupId>
  <artifactId>splunk-library-javalogging</artifactId>
  <version>1.6.2</version>
</dependency>

 

I made sure that Spring Boot is loaded this way:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <version>${version.spring.boot}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-log4j2</artifactId>
  <version>2.5.4</version>
</dependency>
  

 

I created an appender this way:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" name="LoggingTesting" packages="">
  <Appenders>
    <SplunkHttp name="SPLUNK_APPENDER_1"
                url="http://SPLUNK_IP:8088/services/collector/event"
                token="MY_TOKEN"
                source="SampleJavaAppender1"
                messageFormat="text"
                batch_size_bytes="0"
                batch_size_count="5"
                batch_interval="0"
                connect_timeout="5000"
                disableCertificateValidation="true">
      <PatternLayout pattern="%m"/>
    </SplunkHttp>

 

When I launch my application, I get this error:

main ERROR Error processing element SplunkHttp ([Appenders: null]): CLASS_NOT_FOUND
main ERROR Unable to locate appender "SPLUNK_APPENDER_1" for logger config "root"

This was all based on the sample Log4J2 configuration .

What am I missing in my configuration?

Labels (1)
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...