Star us on GitHub
Star
Menu

Logging in Java Quick Start

Learn how to set up highlight.io Java log ingestion.
1
Set up your frontend highlight.io integration.

First, make sure you've followed the frontend getting started guide.

2
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>
Copy
3
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);
Copy
4
Set up and call the Highlight Logger.

Highlight.captureLog() will record and send logs to Highlight.

Highlight.captureLog(Severity.INFO, "Just another message");
Copy
5
Set up and call the Highlight custom records.

Highlight.captureRecord() will send custom defined logs to Highlight.

Highlight.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());
Copy
6
Verify your backend logs are being recorded.

Visit the highlight logs portal and check that backend logs are coming in.