Backend: Error Monitoring
Backend: Logging
Go
JS
Python
Ruby
Java
Rust
Hosting Providers
Backend: Tracing
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Using highlight.io with Java Frameworks
Learn how to set up highlight.io on your Java backend.
1
Install the Highlight Java SDK.
Add Highlight to your maven pom file.
<dependency>
<groupId>io.highlight</groupId>
<artifactId>highlight-sdk</artifactId>
<version>latest</version>
</dependency>
2
Initialize the Highlight Java SDK.
Highlight.init()
initializes the Highlight backend SDK.
HighlightOptions options = HighlightOptions.builder("<YOUR_PROJECT_ID>")
.version("1.0.0")
.environment("development")
.build();
Highlight.init(options);
3
Add Highlight logger.
errors will automatically record raised exceptions and send them to Highlight.
Coming soon
4
Verify your errors are being recorded.
Now that you've set up the Middleware, verify that the backend error handling works by consuming an error from traced code.
5
Record custom errors. (optional)
If you want to explicitly send an error to Highlight, you can use the Highlight.captureException()
method.
try {
} catch (Exception ex) {
Highlight.captureException(exception);
}
6
Using sessions
When everything is finished and working, you can try to use sessions. You can find more information about the SESSION_ID
here parseHeaders
HighlightSession session = new HighlightSession("SESSION_ID");
session.captureException(new NullPointerException("This shouldn't happen"));
session.captureLog(Severity.INFO, "Just another message");
session.captureRecord(HighlightRecord.log()
.severity(Severity.warn("Internal", Priority.HIGH))
.message("Just another message")
.requestId("REQUEST_ID")
.attributes(attributes -> attributes.put("application.user.name", "NgLoader"))
.build());
7
Set up logging.
Start sending logs to Highlight! Follow the logging setup guide to get started.