Description Overview
현재 문서와 코드 모두에서 로그 카테고리 와 요청 상관관계 추적 이 섞여 있다.
이 이슈는 두 개념을 분리해서 설계하는 데 초점을 둔다.
Details
access, application, audit 는 로그의 성격을 나누는 카테고리다.
requestId, traceId, memberId, linkId, chatId 로 같은 요청을 이어 보는 것은 상관관계 추적 방식이다.
지금 로그는 요청별로 이어서 보기 어렵다.
HTTP 요청 로그와 비즈니스 로그, 비동기 로그, 외부 AI 호출 로그가 같은 흐름으로 묶이지 않는다.
@Async, 수동 worker thread, CompletableFuture 후속 처리에서 MDC 전파가 없다.
작업 내용
로그 카테고리를 최소 아래처럼 정의한다.
access
application
audit
카테고리별 기본 필드를 정의한다.
access: requestId, method, path, status, latencyMs, clientIp
application: requestId, memberId, linkId, chatId, action, result
audit: requestId, actor, event, target, result
같은 요청을 이어 보기 위한 공통 상관관계 키를 정의한다.
최소 requestId
가능하면 traceId
도메인 키 memberId, linkId, chatId
servlet filter 에서 MDC 를 세팅하고 요청 종료 시 정리한다.
@Async executor, event listener, 수동 worker thread 에 MDC 전파를 적용한다.
파일 분리는 별도 결정 사항으로 두되, 설계상 카테고리와 저장 위치를 혼동하지 않도록 문서화한다.
Expected Outcome
access/app/audit 는 카테고리로, requestId 기반 연결 은 추적 방식으로 명확히 구분된다.
요청 1건을 access -> application -> async application -> external-api application 흐름으로 이어서 볼 수 있다.
파일을 하나로 두든 여러 개로 나누든 같은 설계 원칙을 유지할 수 있다.
Reactions are currently unavailable
You can’t perform that action at this time.
Overview
로그 카테고리와요청 상관관계 추적이 섞여 있다.Details
access,application,audit는 로그의 성격을 나누는 카테고리다.requestId,traceId,memberId,linkId,chatId로 같은 요청을 이어 보는 것은 상관관계 추적 방식이다.@Async, 수동 worker thread,CompletableFuture후속 처리에서 MDC 전파가 없다.작업 내용
accessapplicationauditaccess:requestId,method,path,status,latencyMs,clientIpapplication:requestId,memberId,linkId,chatId,action,resultaudit:requestId,actor,event,target,resultrequestIdtraceIdmemberId,linkId,chatId@Asyncexecutor, event listener, 수동 worker thread 에 MDC 전파를 적용한다.Expected Outcome
access/app/audit는 카테고리로,requestId 기반 연결은 추적 방식으로 명확히 구분된다.access -> application -> async application -> external-api application흐름으로 이어서 볼 수 있다.