Replies: 1 comment
|
수고하셨습니다! 정리를 용학님 스타일 대로 너무 잘 정리해주셨네요 ㅎㅎ |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
예제 프로젝트 만들기
OrderRepositoryV0
OrderServiceV0
OrderControllerV0
로그 추적기 - 요구사항 분석
미션
요구사항
- 로그를 남긴다고 해서 비즈니스 로직의 동작에 영향을 주면 안됨
- 예외 발생시 예외 정보가 남아야 함
- HTTP 요청 단위로 특정 ID를 남겨서 어떤 HTTP 요청에서 시작된 것인지 명확하게
구분이 가능해야 함
- 트랜잭션 ID (DB 트랜잭션X), 여기서는 하나의 HTTP 요청이 시작해서 끝날 때 까지를
하나의 트랜잭션이라 함
예시
로그 추적기 V1 - 프로토타입 개발
TraceId
TraceId 클래스
UUID
createNextId()
createPreviousId()
isFirstLevel()
TraceStatus -- 로그의 상태 정보를 나타냄
HelloTraceV1 -- 실제 로그 시작과 종료 가능, 로그를 출력하고 실행시간 측정 가능
complete(TraceStatus status, Exception e)
String addSpace(String prefix, int level)
prefix: -->
prefix: <--
prefix: <X-
테스트 작성
begin_end() -- 실행 로그
[41bbb3b7] hello
[41bbb3b7] hello time=5ms
begin_exception() -- 실행 로그
[898a3def] hello
[898a3def] hello time=13ms ex=java.lang.IllegalStateException
All reactions