Splunk logging for Java enables you to log events to HTTP Event Collector or to a TCP input on a Splunk Enterprise instance within your Java applications. You can use three major Java logging frameworks: Logback, Log4j 2, and java.util.logging. Splunk logging for Java is also enabled for Simple Logging Facade for Java (SLF4J).
Splunk logging for Java provides:
-
Appender classes that package events into the proper format for the input type you're using (HTTP Event Collector or TCP).
-
Handler classes that export the logging events.
-
An optional error handler to catch failures for HTTP Event Collector events.
-
Example configuration files for all three frameworks that show how to configure the frameworks to write to HTTP Event Collector or TCP ports.
-
Support for batching events (sent to HTTP Event Collector only).
Here's what you need to get going with Splunk logging for Java.
If you haven't already installed Splunk, download it here. For more about installing and running Splunk and system requirements, see Installing & Running Splunk. Splunk logging for Java is tested with Splunk Enterprise 7.0 and 7.2.
You'll need Java version 8 or higher, from OpenJDK or Oracle.
-
For more information about installing and using Splunk logging for Java, see Overview of Splunk logging for Java.
-
For reference documentation, see the [Splunk logging for Java API reference](https://docs.splunk.com /DocumentationStatic/JavaLogging/1.8.0/index.html).
-
For all things developer with Splunk, see the Splunk Developer Portal.
-
For more about about Splunk in general, see Splunk>Docs.
Splunk logging for Java is licensed under the Apache License 2.0.
See the LICENSE file for details.
Get the Splunk Java Logging Framework from GitHub and clone the resources to your computer. For example, use the following command:
git clone https://github.com/splunk/splunk-library-javalogging.git
The Splunk logging for Java is community-supported.
- You can find help through our community on Splunk Answers (use the "logging-library-java" tag to identify your questions).
- File issues on GitHub.
You can reach the Dev Platform team at [email protected].