Skip to content

Commit 19a9a6c

Browse files
adinauerseer-by-sentry[bot]coolguyzone
authored
Document logs for Log4j2 and JUL (#14150)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR *Tell us what you're changing and why. If your PR **resolves an issue**, please link it so it closes automatically.* ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
1 parent 29b620f commit 19a9a6c

File tree

8 files changed

+76
-6
lines changed

8 files changed

+76
-6
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Available integrations:
2-
- [Logback](/platforms/java/guides/logback/logs/)
32
- [Spring Boot using Logback](/platforms/java/guides/spring-boot/logging-frameworks/)
3+
- [Logback](/platforms/java/guides/logback/logs/)
4+
- [Log4j2](/platforms/java/guides/log4j2/logs/)
5+
- [JUL](/platforms/java/guides/jul/logs/)
46

5-
We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see.
6-
7-
- [Log4j2](https://github.com/getsentry/sentry-java/issues/4403)
8-
- [JUL](https://github.com/getsentry/sentry-java/issues/4405)
7+
If there's an integration you would like to see, open a [new issue on GitHub](https://github.com/getsentry/sentry-java/issues/new/choose).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Logs for JUL are supported in Sentry Java SDK version `8.16.0` and above.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Logs for Log4j2 are supported in Sentry Java SDK version `8.16.0` and above.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Logs for Spring Boot are supported in Sentry Java SDK version `8.15.0` and above.
1+
Logs for Spring Boot are supported in Sentry Java SDK version `8.15.1` and above.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
To enable logging, you need to configure the option in `sentry.properties` or when calling `Sentry.init`.
2+
3+
```properties {tabTitle: sentry.properties}
4+
logs.enabled=true
5+
```
6+
7+
```java {tabTitle: Sentry.init (Java)} {5}
8+
import io.sentry.Sentry;
9+
10+
Sentry.init(options -> {
11+
options.setDsn("___PUBLIC_DSN___");
12+
options.getLogs().setEnabled(true);
13+
});
14+
```
15+
16+
```kotlin {tabTitle: Sentry.init(Kotlin)} {5}
17+
import io.sentry.Sentry
18+
19+
Sentry.init { options ->
20+
options.dsn = "___PUBLIC_DSN___"
21+
options.logs.enabled = true
22+
}
23+
```
24+
25+
You may also configure the Sentry handler and set `minimumLevel` in `logging.properties`:
26+
27+
```properties {tabTitle: logging.properties} {5}
28+
# Configure the Sentry handler
29+
handlers=io.sentry.jul.SentryHandler
30+
31+
# Set the minimum level for Sentry handler
32+
io.sentry.jul.SentryHandler.minimumLevel=CONFIG
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
To enable logging, you need to configure the option in `sentry.properties` or when calling `Sentry.init`.
2+
3+
```properties {tabTitle: sentry.properties}
4+
logs.enabled=true
5+
```
6+
7+
```java {tabTitle: Sentry.init (Java)} {5}
8+
import io.sentry.Sentry;
9+
10+
Sentry.init(options -> {
11+
options.setDsn("___PUBLIC_DSN___");
12+
options.getLogs().setEnabled(true);
13+
});
14+
```
15+
16+
```kotlin {tabTitle: Sentry.init(Kotlin)} {5}
17+
import io.sentry.Sentry
18+
19+
Sentry.init { options ->
20+
options.dsn = "___PUBLIC_DSN___"
21+
options.logs.enabled = true
22+
}
23+
```
24+
25+
You may also set `minimumLevel` in `log4j2.xml` to configure which log messages are sent to Sentry.
26+
27+
```xml {tabTitle: log4j2.xml} {6}
28+
<Sentry
29+
name="Sentry"
30+
dsn="your DSN"
31+
minimumBreadcrumbLevel="DEBUG"
32+
minimumEventLevel="WARN"
33+
minimumLevel="DEBUG"
34+
/>
35+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Once the handler is configured with logging enabled, any logs at or above the `minimumLevel` will be sent to Sentry.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Once the handler is configured with logging enabled, any logs at or above the `minimumLevel` will be sent to Sentry.

0 commit comments

Comments
 (0)