Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling Sentry.init and specifying contextTags now has an effect on the Log4j SentryAppender #2054

Merged
merged 7 commits into from
May 25, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Calling Sentry.init and specifying contextTags now has an effect on the Logback SentryAppender ([#2052](https://github.com/getsentry/sentry-java/pull/2052))
- Calling Sentry.init and specifying contextTags now has an effect on the Log4j SentryAppender ([#2054](https://github.com/getsentry/sentry-java/pull/2054))

## 6.0.0-beta.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public void append(final @NotNull LogEvent eventObject) {
CollectionUtils.filterMapEntries(
loggingEvent.getContextData().toMap(), entry -> entry.getValue() != null);
if (!contextData.isEmpty()) {
// get tags from HubAdapter options to allow getting the correct tags if Sentry has been
// initialized somewhere else
final List<String> contextTags = hub.getOptions().getContextTags();
if (contextTags != null && !contextTags.isEmpty()) {
for (final String contextTag : contextTags) {
// if mdc tag is listed in SentryOptions, apply as event tag
Expand Down