SDKs
Java
Bugzor works with the open-source io.sentry Java SDK, which also covers Kotlin and other JVM languages. Tested with sentry-java 8.16 on Java 21.
Install#
Gradle:
dependencies {
implementation("io.sentry:sentry:8.16.0")
}Maven:
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>8.16.0</version>
</dependency>Configure#
import io.sentry.Sentry;
public class Main {
public static void main(String[] args) {
Sentry.init(options -> {
options.setDsn("https://<public-key>@www.bugzor.com/<project-id>");
options.setEnvironment("production");
options.setRelease("my-app@1.0.0");
});
try {
Integer.parseInt("not a number");
} catch (Exception e) {
Sentry.captureException(e);
}
Sentry.captureMessage("Hello from Java");
}
}Sentry.init also installs an uncaught exception handler. The SDK sends in the background and flushes on
JVM shutdown. Call Sentry.flush(2000) if you exit with Runtime.halt.
You can leave the DSN out of the code and set the SENTRY_DSN environment variable instead.
Spring Boot#
Use the starter instead of the plain SDK (Spring Boot 3):
dependencies {
implementation("io.sentry:sentry-spring-boot-starter-jakarta:8.16.0")
}sentry.dsn=https://<public-key>@www.bugzor.com/<project-id>
sentry.environment=production
sentry.send-default-pii=trueUnhandled exceptions from controllers are reported with the request and the signed-in user.
Logback#
Report ERROR logs as events and keep lower levels as breadcrumbs with io.sentry:sentry-logback:
<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
<options>
<dsn>https://<public-key>@www.bugzor.com/<project-id></dsn>
</options>
</appender>
<root level="INFO">
<appender-ref ref="SENTRY" />
</root>Add context#
import io.sentry.protocol.User;
User user = new User();
user.setId("42");
user.setEmail("ann@example.com");
Sentry.setUser(user);
Sentry.withScope(scope -> {
scope.setTag("component", "checkout");
Sentry.captureMessage("Cart total mismatch");
});Android#
The Android SDK (io.sentry:sentry-android) works the same way. Set the DSN in AndroidManifest.xml
(io.sentry.dsn meta-data) to your Bugzor DSN.
Something unclear or out of date? Tell us.