Skip to content

[Infra] - MDC 로깅 구현 및 프롬테일 추가#11

Merged
nak-honest merged 21 commits intodevelopfrom
feature/#10
Aug 11, 2025
Merged

[Infra] - MDC 로깅 구현 및 프롬테일 추가#11
nak-honest merged 21 commits intodevelopfrom
feature/#10

Conversation

@nak-honest
Copy link
Member

간단하게 기존 인터뷰 쪽 코드 거의 그대로 가져왔습니다!

@nak-honest nak-honest self-assigned this Jul 28, 2025
Comment on lines +41 to +47
log.info("{} {} ({}) - {}ms",
request.getMethod(),
request.getRequestURI(),
HttpStatus.valueOf(response.getStatus()),
stopWatch.getTotalTimeMillis());

MDC.clear();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal 에서는 멤버 id를 로그에 찍지 않도록 하였습니다.

@github-actions
Copy link

github-actions bot commented Jul 28, 2025

Test Results

4 tests   4 ✅  0s ⏱️
2 suites  0 💤
2 files    0 ❌

Results for commit 3b27421.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@kargowild kargowild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사소한 질문 몇개 남겼어요! 구두로 말씀드린대로 CORS 설정 쪽 바꾸고, cd에 임시로 설정한 값들 원복만 시키면 될 것 같습니다 ㅎㅎ 멀티모듈쪽은 아리까리 한게 정말 많네요. 한 번 제대로 정리해봐야겠어요.

Comment on lines -81 to +84
git fetch origin develop
git checkout develop
git fetch origin feature/#10
git checkout feature/#10
git sparse-checkout set docker/dev
git pull origin develop
git pull origin feature/#10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

머지하기 전에는 원복해야겠네요!

Comment on lines -4 to 5
on:
push:
pull_request:
branches: [ develop ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

머지하기 전에는 원복해야겠네요!

Comment on lines 80 to +84
git sparse-checkout init --cone
git fetch origin develop
git checkout develop
git fetch origin feature/#10
git checkout feature/#10
git sparse-checkout set docker/dev
git pull origin develop
git pull origin feature/#10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

머지하기 전에는 원복해야겠네요!

Comment on lines -4 to 5
on:
push:
pull_request:
branches: [ develop ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

머지하기 전에는 원복해야겠네요!

Comment on lines 61 to 62
cors:
allowed-origins: https://kokomen.kr, https://www.kokomen.kr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아까 kokomen repository에 추가했던 web view 위한 cors도 미리 추가하면 좋겠네요! + dev 프로파일 쪽도!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 추가 완료하였습니다!

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
<![CDATA[[%X{requestId:-noRequest}] %d{yyyy-MM-dd HH:mm:ss.SSS} kokomen-notification [%thread] %-5level %logger{36} - %msg%n]]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

간단한 질문) 아래 FILE Appender에서는
${springAppName:-kokomen-notification}로 해주셨는데, 여기서는 곧바로 kokomen-notification으로 설정한 이유가 있을까요?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

누락입니다! 통일 완료했습니다!

'"$http_user_agent" "$http_x_forwarded_for" '
'"$ssl_protocol/$ssl_cipher" "$content_length" "$request_length"';

log_format internal_log '$http_x_requestid $remote_addr - $remote_user [$time_local] "$request" '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기록용)

📌 $http_x_requestid 의미
Nginx에서는 모든 HTTP 요청 헤더에 대해 자동으로 $http_<헤더이름> 형식으로 변수를 만듭니다.

헤더 이름의 대문자는 소문자로 바뀌고, 하이픈(-)은 밑줄(_)로 바뀝니다.

따라서 X-RequestID → $http_x_requestid

real_ip_header X-Forwarded-For;
real_ip_recursive on;

server_name notification-api.kokomen.kr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server_name을 설정하면 Host에 있는 도메인 기반 포워딩을 하는거군요!

@nak-honest nak-honest merged commit 1fe5c55 into develop Aug 11, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants