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

ContextTags are not always taken into account in logging frameworks integration #2043

Closed
maciejwalkowiak opened this issue May 12, 2022 · 2 comments
Assignees
Labels
Platform: Java Type: Bug Something isn't working
Milestone

Comments

@maciejwalkowiak
Copy link
Contributor

Integration

sentry-logback

Java Version

8

Version

6.0.0

Steps to Reproduce

  1. Add Sentry appender to logback.xml
<appender name="sentry" class="io.sentry.logback.SentryAppender"/>
  1. Initialize Sentry from Java code:
Sentry.init(opts -> {
            opts.setDsn(..);
            opts.addContextTag("userId");
        });
  1. Put data to MDC and trigger event:
MDC.put("userId", "maciej");
LOGGER.error("Ooops", new RuntimeException());

Expected Result

userId value should be set as tag

Actual Result

userId value is set to contexts.

This happens only when Logback/Log4j2 integration is used, but the Sentry init happens in the Java code. Both appenders refer to the SentryOptions set on appenders, and not the SentryOptions that are in use by an actual Sentry object.

@marandaneto
Copy link
Contributor

@maciejwalkowiak is it related to https://github.com/getsentry/sentry-java/pull/1954/files ? if so, we should fix it before going GA.

@marandaneto marandaneto added this to the 6.0.0 milestone May 13, 2022
@maciejwalkowiak
Copy link
Contributor Author

@marandaneto yes, it is. Indeed it should be fixed before GA.

@marandaneto marandaneto added the Type: Bug Something isn't working label May 17, 2022
@adinauer adinauer self-assigned this May 17, 2022
adinauer added a commit that referenced this issue May 24, 2022
adinauer added a commit that referenced this issue May 24, 2022
* Fix setting context tags on events captured by Spring

Fixes #2043

* Changelog.

* Move ContextTagsEventProcessor from spring boot to spring module (#2065)

* Fixes after merge

Co-authored-by: Alexander Dinauer <adinauer@users.noreply.github.com>
Co-authored-by: Alexander Dinauer <alexander.dinauer@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Java Type: Bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

4 participants