SDK · Java
Java
Official Bugwatch SDK for Java 11+. Zero external dependencies — a single JAR with a hand-rolled RFC 8259 JSON writer. Events are sent on background threads, so a slow or down Bugwatch server never stalls your application.
Install
pom.xml
<dependency>
<groupId>com.roomylabs</groupId>
<artifactId>bugwatch-sdk</artifactId>
<version>0.1.0</version>
</dependency>Or drop the built JAR on the classpath: bugwatch-sdk-0.1.0.jar.
Quickstart
Java
import com.roomylabs.bugwatch.Bugwatch;
Bugwatch.init(
"https://bw-YOUR_KEY@bugwatch-api.loadmindx.com/api/1",
"production", "1.0.0"
);
try {
riskyOperation();
} catch (Exception e) {
Bugwatch.captureException(e); // full stack trace
}
Bugwatch.captureMessage("Payment confirmed", "info", null);
Bugwatch.flush(); // wait for async sends (short-lived scripts)Context
Java
Bugwatch.setTag("region", "eu-west");
Bugwatch.setUser("42", "alice", java.util.Map.of("plan", "pro"));
Bugwatch.addBreadcrumb("db", "query users");
Bugwatch.clearScope();The user context strips email, ip_address, ip and username before anything leaves the process. Breadcrumbs are capped at 100.
API
| API | Description |
|---|---|
| init(dsn, env, release, debug, pii, allowHttp) | Parse the DSN, validate HTTPS (unless allowHttp). |
| captureException(Throwable) -> String? | Capture an exception with full stack trace and culprit. |
| captureMessage(msg, level, attrs) -> String? | Capture a message: debug, info, warning, error or fatal. |
| setTag(k, v) | Set a tag on subsequent events. |
| setUser(id, username, extra) | Set user context (PII stripped). |
| addBreadcrumb(category, message) | Append to the trail (max 100). |
| clearScope() | Clear tags, user and breadcrumbs. |
| flush() | Join pending sender threads. Call it before the JVM exits. |
