How can I set the user context with the sentry raven-java client?
I've tried adding a user_email
tag, and adding user_email
to the MDC. They both work as expecting, with the tag going to tags, and MDC going to additional data, but neither sets the sentry user context.
I also use sentry with javascript, and with raven-js, this works great:
Raven.setUserContext({
email: '',
id: ''
});
Is there a java equivalent?
Seems can't send user information directly by logback. You can look at the implementation from raven-java:
protected Event buildEvent(ILoggingEvent iLoggingEvent) {
EventBuilder eventBuilder = new EventBuilder()
.withTimestamp(new Date(iLoggingEvent.getTimeStamp()))
.withMessage(iLoggingEvent.getFormattedMessage())
.withLogger(iLoggingEvent.getLoggerName())
.withLevel(formatLevel(iLoggingEvent.getLevel()))
.withExtra(THREAD_NAME, iLoggingEvent.getThreadName());
......
}
User info is send by: withSentryInterface(new UserInterface(...)), however what I see this implement only contains code for: StackTraceInterface and MessageInterface. I think you can add one by your self.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With