-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#564 [feat] sql 로깅 모듈 구현 #568
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AOP를 사용해서 진입점 로그를 기록하는 게 좋은 것 같습니다! 유용한 라이브러리를 알아가네요~ 적용해 주셔서 감사합니다!
if (tmpsql.startsWith("create") || tmpsql.startsWith("alter") || tmpsql.startsWith("comment")) { | ||
sql = FormatStyle.DDL.getFormatter().format(sql); | ||
} else { | ||
sql = FormatStyle.BASIC.getFormatter().format(sql); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DDL과 일반 쿼리를 나눠 포맷팅 해서 더 좋은것 같습니다!
public void sqlLoggingPoint() { | ||
} | ||
|
||
@Around("sqlLoggingPoint()") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요 around로 쿼리 실행될 때 시작지점 기록을 하는거군요 👍
MDC.put(MDC_KEY, "[ QUERY START -> " + joinPoint.getSignature().toShortString() + "]"); | ||
|
||
return joinPoint.proceed(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) 찾아보니 mdc는 스레드로컬 방식으로 관리되는데 aop로 sql 실행시점에 mdc 에 데이터를 넣고 그대로 두면 그 스레드가 이후 다른작업을 할때도 같은 값을 사용할 수 있어서 메서드가 끝나면 mdc.remove나 clear를 하는 게 좋다고 합니다! try-finally 사용해서 메서드 실행 후, finally { MDC.remove(MDC_KEY); } 해주는건 어떻게 생각하시나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옷 아주 좋습니다! request ID 담고 있는 부분도 포함해서 수정하겠습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋습니댜!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✒️ 관련 이슈번호
Key Changes 🔑
결과는 아래와 같습니다!
To Reviewers 📢