Merge pull request #15903 from eugenp/comment-17022024

Change log level
This commit is contained in:
Ulisses Lima 2024-02-19 11:01:08 -03:00 committed by GitHub
commit c48af54d80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -10,9 +10,9 @@ public class GreetingServiceWithoutAOP {
private static final Logger logger = LoggerFactory.getLogger(GreetingServiceWithoutAOP.class);
public String greet(String name) {
logger.info(">> greet() - {}", name);
logger.debug(">> greet() - {}", name);
String result = String.format("Hello %s", name);
logger.info("<< greet() - {}", result);
logger.debug("<< greet() - {}", result);
return result;
}
}

View File

@ -28,13 +28,13 @@ public class LoggingAspect {
public void logBefore(JoinPoint joinPoint) {
Object[] args = joinPoint.getArgs();
String methodName = joinPoint.getSignature().getName();
logger.info(">> {}() - {}", methodName, Arrays.toString(args));
logger.debug(">> {}() - {}", methodName, Arrays.toString(args));
}
@AfterReturning(value = "publicMethodsFromLoggingPackage()", returning = "result")
public void logAfter(JoinPoint joinPoint, Object result) {
String methodName = joinPoint.getSignature().getName();
logger.info("<< {}() - {}", methodName, result);
logger.debug("<< {}() - {}", methodName, result);
}
@AfterThrowing(pointcut = "publicMethodsFromLoggingPackage()", throwing = "exception")
@ -47,9 +47,9 @@ public class LoggingAspect {
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
Object[] args = joinPoint.getArgs();
String methodName = joinPoint.getSignature().getName();
logger.info(">> {}() - {}", methodName, Arrays.toString(args));
logger.debug(">> {}() - {}", methodName, Arrays.toString(args));
Object result = joinPoint.proceed();
logger.info("<< {}() - {}", methodName, result);
logger.debug("<< {}() - {}", methodName, result);
return result;
}
}