Skip to content

Commit

Permalink
Log sec-org header
Browse files Browse the repository at this point in the history
  • Loading branch information
landryb committed Sep 10, 2020
1 parent 09087ea commit 722d9b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public class PreRequestFilter implements ContainerRequestFilter {
public void filter(ContainerRequestContext requestContext) throws IOException {

String rolesList = requestContext.getHeaderString("sec-roles");
String org = requestContext.getHeaderString("sec-org");
String userName = requestContext.getHeaderString("sec-username");
MDC.put("user", userName);
MDC.put("org", org);
MDC.put("roles", rolesList);
MDC.put("uri", requestContext.getUriInfo().getPath());

Expand All @@ -34,4 +36,4 @@ public void filter(ContainerRequestContext requestContext) throws IOException {
}

}
}
}
4 changes: 2 additions & 2 deletions cadastrapp/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>/tmp/cadastrapp.log</file>
<encoder>
<pattern>%d [%thread] %-5level /%X{uri} - %X{user:-nouser} - %X{roles:-norole} -%logger{36} - %msg%n</pattern>
<pattern>%d [%thread] %-5level /%X{uri} - %X{user:-nouser} - %X{org:-noorg} - %X{roles:-norole} -%logger{36} - %msg%n</pattern>
</encoder>
</appender>


<root level="DEBUG">
<appender-ref ref="FILE" />
</root>
</configuration>
</configuration>

0 comments on commit 722d9b8

Please sign in to comment.