Skip to content

Commit 34f4b72

Browse files
authored
Do not use Sentry logging API if logs are disabled for JUL (#4574)
* Do not use Sentry logging API if logs are disabled for JUL * changelog
1 parent 6c58c54 commit 34f4b72

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
- Allow multiple UncaughtExceptionHandlerIntegrations to be active at the same time ([#4462](https://github.com/getsentry/sentry-java/pull/4462))
2727
- Prevent repeated scroll target determination during a single scroll gesture ([#4557](https://github.com/getsentry/sentry-java/pull/4557))
2828
- This should reduce the number of ANRs seen in `SentryGestureListener`
29+
- Do not use Sentry logging API in JUL if logs are disabled ([#4574](https://github.com/getsentry/sentry-java/pull/4574))
30+
- This was causing Sentry SDK to log warnings: "Sentry Log is disabled and this 'logger' call is a no-op."
2931
- Do not use Sentry logging API in Log4j2 if logs are disabled ([#4573](https://github.com/getsentry/sentry-java/pull/4573))
3032
- This was causing Sentry SDK to log warnings: "Sentry Log is disabled and this 'logger' call is a no-op."
3133

sentry-jul/src/main/java/io/sentry/jul/SentryHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ public void publish(final @NotNull LogRecord record) {
111111
return;
112112
}
113113
try {
114-
if (record.getLevel().intValue() >= minimumLevel.intValue()) {
114+
if (ScopesAdapter.getInstance().getOptions().getLogs().isEnabled()
115+
&& record.getLevel().intValue() >= minimumLevel.intValue()) {
115116
captureLog(record);
116117
}
117118
if (record.getLevel().intValue() >= minimumEventLevel.intValue()) {

0 commit comments

Comments
 (0)