SDKs
Java SDK
Install the Logdash Java SDK, send your first log and your first metric.
Install the package, add your ingest key and the first log lands in the dashboard within a second. Everything below is copied from the Java SDK README.
Install
// build.gradle
dependencies {
implementation 'io.logdash:logdash:0.2.0'
} Initialise
Copy the ingest key from your domain's settings in Logdash and keep it in an environment variable. The key identifies the domain the data lands in, and app names the program that sends, such as api or worker. See Apps.
import io.logdash.sdk.Logdash;
var logdash = Logdash.builder()
.apiKey(System.getenv("LOGDASH_API_KEY"))
.app("api")
.build();
var logger = logdash.logger();
var metrics = logdash.metrics(); Send a log
import java.util.Map;
logger.info("Application started");
logger.error("Database connection failed");
// Structured logging with context
logger.info("Payment processed", Map.of(
"userId", 12345,
"amount", 29.99,
"currency", "USD"
)); Send a metric
Metrics are named numbers. Set one to an absolute value or mutate it by a delta, and Logdash charts the history.
// Gauges - track current values
metrics.set("active_users", 1_250);
// Counters - track events and occurrences
metrics.mutate("api_requests", 1); Send an event
Events go to web analytics of the domain, next to the custom events of your website, with the same rules for names and properties.
import java.util.Map;
logdash.track("agent_run", Map.of("agent", "support", "steps", 4, "success", true), user.id()); Flush before exit
The SDK sends in the background. In a short-lived process, such as a cron job, a CLI or a serverless function, send what is still queued before the process exits.
logdash.flush();
logdash.close(); Works with
- Spring Boot
- Quarkus
- Micronaut
- Standalone apps
FAQ
How do I install it with Maven instead of Gradle?
pom.xml: groupId io.logdash, artifactId logdash, version 0.2.0.Which Java versions are supported?
Do logging calls block the request thread?
logdash.flush() and logdash.close() before shutdown.Copied from the java-sdk README at f6898db on 2026-11-09.