From ff272d2dde18ba208e74c3ce8391c686effb7d60 Mon Sep 17 00:00:00 2001 From: Ana Peterlic Date: Sat, 17 Feb 2024 06:59:18 +0100 Subject: [PATCH 1/2] Change log level --- .../src/main/java/com/baeldung/logging/LoggingAspect.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-aop-2/src/main/java/com/baeldung/logging/LoggingAspect.java b/spring-aop-2/src/main/java/com/baeldung/logging/LoggingAspect.java index 6641b70eec..82b52bea25 100644 --- a/spring-aop-2/src/main/java/com/baeldung/logging/LoggingAspect.java +++ b/spring-aop-2/src/main/java/com/baeldung/logging/LoggingAspect.java @@ -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; } } From c96bfc17634741f7bdd8c72674085ef96c71f11b Mon Sep 17 00:00:00 2001 From: Ana Peterlic Date: Sat, 17 Feb 2024 18:13:10 +0100 Subject: [PATCH 2/2] Update GreetingServiceWithoutAOP.java --- .../java/com/baeldung/logging/GreetingServiceWithoutAOP.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-aop-2/src/main/java/com/baeldung/logging/GreetingServiceWithoutAOP.java b/spring-aop-2/src/main/java/com/baeldung/logging/GreetingServiceWithoutAOP.java index eee90af669..f13c70f93b 100644 --- a/spring-aop-2/src/main/java/com/baeldung/logging/GreetingServiceWithoutAOP.java +++ b/spring-aop-2/src/main/java/com/baeldung/logging/GreetingServiceWithoutAOP.java @@ -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; } }