Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
quanpham-axonivy committed Dec 19, 2024
1 parent f1b7648 commit 5e90bf0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.log4j.Log4j2;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
Expand All @@ -32,12 +32,14 @@ public class LoggableAspect {
@Value("${loggable.log-path}")
public String logFilePath;

@Before("@annotation(com.axonivy.market.logging.Loggable)")
@Around("@annotation(com.axonivy.market.logging.Loggable)")
public void logMethodCall(JoinPoint joinPoint) throws MissingHeaderException {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
log.debug("#extractHeaders arguments {} ---- {}", signature.getParameterNames(), joinPoint.getArgs());
log.info("#extractHeaders arguments {} ---- {}", signature.getParameterNames(), joinPoint.getArgs());
HttpServletRequest request = attributes.getRequest();
Map<String, String> headersMap = extractHeaders(request, signature, joinPoint);
saveLogToDailyFile(headersMap);
Expand Down

0 comments on commit 5e90bf0

Please sign in to comment.