-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add slf4j
requst logger
#3146
Add slf4j
requst logger
#3146
Conversation
LOG.info("%s", line); | ||
} | ||
finally { | ||
if (setMDC && mdc != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need to reset it regardless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right. SLF4J docs say getCopyOfContextMap
may return null, and the source makes it look like that will happen if nobody ever set up any MDC keys. So if mdc
is null then it's probably best to call MDC.clear()
to reset the MDC here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, also cleaned up code paths a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mdc is always fetched prior to logging, but only reset if setMDC
was called
@drcrallen looks useful, left some comments in the diff. |
@drcrallen one of the tests isn't compiling, message is: 👍 other than that |
@gianm fixed, thanks for the insight there |
rad, thanks @drcrallen. 👍 after travis |
👍 |
Inspired by https://groups.google.com/d/msg/druid-user/3x5VPPOa_M4/BrVYmdcrAAAJ