-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 the ability to configure logback (MDC) to show identity_id
and X-Request-ID
in logs files when available.
#7461
Conversation
identity_id and X-Request-ID - what is the usecase for this value? |
I'm going to move the filter for request id somewhere else |
Identity_id - ok. What does this value |
For Che it means that wherever the cluster environnement it is installed and where routers are using |
What about the separate artifact and reuse it on the agent? |
OK I'm OK to create a separate artifact, I was looking at an existing one and https://github.com/eclipse/che/tree/master/core/commons/che-core-commons-j2ee/src/main/java/org/eclipse/che/filter was looking good by its name but it seems to be included only in |
About the web application name, I'm not sure MDC is the right place: MDC works per thread and pretty much like a threadLocal would work. |
what if core/commons/che-core-commons-logback ? |
8021e02
to
31d2e4d
Compare
I've updated the PR but for some reasons i can't get into the multi-user app, will investigate tomorow |
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<scope>provided</scope> |
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 artifact is not provided. please remove this scope.
import javax.servlet.ServletResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
import org.slf4j.MDC; | ||
|
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.
javadoc
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.
What about test?
@@ -103,6 +106,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha | |||
} | |||
} | |||
|
|||
putIdentityIdToMDC(subject); |
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 can replace it with just MDC.put(IDENTITY_ID_MDC_KEY, subject.getUserId());
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.
wait. It should not be here.
I propose to make a separate filter in core/commons/che-core-commons-logback/ that will put subject id in mdc.
31d2e4d
to
3a3dac2
Compare
Signed-off-by: Sun Tan <sutan@redhat.com>
Signed-off-by: Sun Tan <sutan@redhat.com>
3a3dac2
to
fe36833
Compare
@skabashnyuk I've updated this PR can you check and approve if ok ? thanks |
thanks |
@sunix will you provide che6 pr? |
What does this PR do?
Add the ability to configure logback to show
identity_id
andX-Request-ID
in logs files when available.X-Request-ID
http header in the logs through MDCWhat issues does this PR fix or reference?
redhat-developer/rh-che#312
Release Notes
Add the ability to configure logback to show
identity_id
andX-Request-ID
in logs files when available.Docs PR
TODO