Skip to content

Implement MDC logging for request tracking and enhance error handling…#36

Merged
subsub97 merged 1 commit intomainfrom
mdc
Mar 16, 2026
Merged

Implement MDC logging for request tracking and enhance error handling…#36
subsub97 merged 1 commit intomainfrom
mdc

Conversation

@subsub97
Copy link
Collaborator

This pull request introduces improvements to logging and error handling in the application, focusing on better traceability of requests and user actions. The main changes include adding MDC-based logging for request and member identifiers, enhancing exception logging, and updating log configuration for improved clarity. Additionally, push notification configuration is updated for higher priority delivery.

Logging enhancements:

  • Added a new MdcLoggingFilter to inject a short requestId into MDC for each request, log request start/end, and clear MDC after each request, improving traceability across logs. (src/main/kotlin/com/moa/common/filter/MdcLoggingFilter.kt)
  • Updated AuthMemberResolver and OnboardingAuthMemberResolver to add the authenticated memberId to MDC, enabling user-level tracking in logs. (src/main/kotlin/com/moa/common/auth/AuthMemberResolver.kt, src/main/kotlin/com/moa/common/auth/OnboardingAuthMemberResolver.kt) [1] [2]

Log configuration:

  • Added a new logback-spring.xml configuration file to format logs with requestId and memberId, and set log levels for local and production environments. (src/main/resources/logback-spring.xml)

Exception handling improvements:

  • Enhanced GlobalExceptionHandler to log HTTP method, URI, and error code for unauthorized and forbidden exceptions, providing better context for security-related issues. (src/main/kotlin/com/moa/common/exception/GlobalExceptionHandler.kt)

Push notification configuration:

  • Updated FcmService to set Android push notification priority to HIGH, ensuring faster delivery of important messages. (src/main/kotlin/com/moa/service/FcmService.kt)

Miscellaneous:

  • Removed show_sql: true from Hibernate properties in the local Spring configuration to reduce log noise. (src/main/resources/application-local.yml)… with member ID context and Change Android Notification Priority

… with member ID context and Change Android Notification Priority
@github-actions
Copy link

Test Results

32 tests   32 ✅  0s ⏱️
 3 suites   0 💤
 3 files     0 ❌

Results for commit fa25891.

Copy link
Member

@jeyongsong jeyongsong left a comment

Choose a reason for hiding this comment

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

오 이제 봤넴 고고고

@subsub97 subsub97 merged commit 957c683 into main Mar 16, 2026
3 checks passed
@subsub97 subsub97 deleted the mdc branch March 16, 2026 12:28
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