Skip to content

Commit

Permalink
Merge pull request #38 from 7JEON8KI/fix/Log-server
Browse files Browse the repository at this point in the history
서버간 요청 LOG 제외
  • Loading branch information
kangeunku authored Mar 2, 2024
2 parents 62a2f52 + 0f2ee86 commit 7e8a9dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/hyundai/global/filter/LogFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
Map<String, Object> logs = new HashMap<>();
String body = new String(wrappedRequest.getContentAsByteArray(), StandardCharsets.UTF_8);
String ipAddr = getIpAddr(request);
if (ipAddr.startsWith("10.11")) return;
try{
String memberId = ((CustomMemberDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getMemberId();
logs.put("uri", request.getRequestURI());
logs.put("method", request.getMethod());
logs.put("ipAddr", ipAddr);
logs.put("localAddr", request.getLocalAddr());
logs.put("memberId", memberId);
logs.put("body", body);
try {
Expand All @@ -65,7 +65,6 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
logs.put("uri", request.getRequestURI());
logs.put("method", request.getMethod());
logs.put("ipAddr", ipAddr);
logs.put("localAddr", request.getLocalAddr());
logs.put("memberId", "");
logs.put("body", body);
logMapper.insertLog(logs);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/com/hyundai/global/mapper/LogMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

<insert id="insertLog" parameterType="map">
INSERT INTO tbl_log
(log_uri, log_method, log_ipaddr, log_localaddr, log_member_id, log_request_body)
(log_uri, log_method, log_ipaddr, log_member_id, log_request_body)
VALUES
(#{uri}, #{method}, #{ipAddr}, #{localAddr}, #{memberId}, #{body})
(#{uri}, #{method}, #{ipAddr}, #{memberId}, #{body})
</insert>
</mapper>

0 comments on commit 7e8a9dc

Please sign in to comment.