Repository navigation
fix(logging): emit explicit auth log line so user_email actually reaches stdout - #96
Merged
Merged
Conversation
…hes stdout 프로덕션 파드 로그를 직접 확인해보니 2시간 동안 JSON 포맷 로그가 0줄이었다. uvicorn CLI가 "uvicorn"/"uvicorn.access"/"uvicorn.error" 로거를 자체 핸들러+plain-text 포매터로 구성하면서 propagate=False로 설정하기 때문에, 모든 요청 로그(access log)가 OtelJsonFormatter가 붙은 root logger를 완전히 우회하고 있었다. 게다가 앱 코드 어디에도 요청 단위로 명시적인 logger.info() 호출이 없어서, span attribute(user.email)는 정상 기록되고 있었음에도(#95 이후) 그걸 실제 로그 줄로 내보내는 지점 자체가 없었다. get_current_user()에서 span attribute를 세팅한 직후(=span이 아직 살아있는 시점) 명시적으로 로그 한 줄을 남기도록 추가. 로컬에서 OtelJsonFormatter를 직접 실행해 user_email 필드가 정확히 찍히는 것까지 확인함.
wonzz
self-requested a review
July 3, 2026 05:36
wonzz
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
utterai-api-blue) 로그를kubectl logs로 직접 확인해보니 2시간 동안 JSON 포맷 로그가 0줄이었음 — 전부 uvicorn 기본 access log 포맷(INFO: ... "GET ..." 200 OK)uvicorn/uvicorn.access/uvicorn.error로거를 자체 핸들러 + plain-text 포매터로 구성하면서propagate: False를 설정 →OtelJsonFormatter가 붙은 root logger를 완전히 우회logger.info()호출이 없어서, span attribute(user.email, fix(logging): read user_email from span attributes, not a ContextVar #95)는 정상 기록되고 있었지만 그걸 실제 stdout 로그 줄로 내보내는 지점 자체가 없었음 → RDS 접근 문제가 아니라(요청은 전부 200 OK) 애초에 로그 자체가 안 찍히는 문제였음get_current_user()에서 span attribute 세팅 직후(span이 아직 활성 상태) 명시적으로logger.info()한 줄 추가Test plan
OtelJsonFormatter+ span +logger.info()전체 플로우 재현 →user_email필드가 정확히 JSON에 포함되는 것 확인kubectl logs로 실제 stdout에"user_email": "..."JSON 라인이 찍히는지 확인