From 855c70538ad0b727f4fc30aeffa671670c976556 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 11 Jan 2021 09:50:21 +0100 Subject: [PATCH] GH-628 Clean up logging levels Resolves #628 --- .../BeanFactoryAwareFunctionRegistry.java | 4 ++-- .../catalog/SimpleFunctionRegistry.java | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/BeanFactoryAwareFunctionRegistry.java b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/BeanFactoryAwareFunctionRegistry.java index 100294f83..1734527cc 100644 --- a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/BeanFactoryAwareFunctionRegistry.java +++ b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/BeanFactoryAwareFunctionRegistry.java @@ -114,8 +114,8 @@ public class BeanFactoryAwareFunctionRegistry extends SimpleFunctionRegistry imp Set functionRegistratioinNames = super.getNames(null); String[] functionNames = StringUtils.delimitedListToStringArray(functionDefinition.replaceAll(",", "|").trim(), "|"); for (String functionName : functionNames) { - if (functionRegistratioinNames.contains(functionName)) { - logger.info("Skipping function '" + functionName + "' since it is already present"); + if (functionRegistratioinNames.contains(functionName) && logger.isDebugEnabled()) { + logger.debug("Skipping function '" + functionName + "' since it is already present"); } else { Object functionCandidate = this.discoverFunctionInBeanFactory(functionName); diff --git a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java index 9f70696d2..fb8efd33c 100644 --- a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java +++ b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java @@ -229,7 +229,10 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect wrappedFunction = new FunctionInvocationWrapper(function) { @Override Object doApply(Object input) { - logger.info("Executing around advise(s)"); + if (logger.isDebugEnabled()) { + logger.debug("Executing around advise(s): " + functionAroundWrapper); + } + return functionAroundWrapper.apply(input, function); } }; @@ -1063,14 +1066,17 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect if (FunctionTypeUtils.isMessage(type)) { if (convertedInput == null) { - /* - * In the event conversion was unsuccessful we simply return the original un-converted message. - * This will help to deal with issues like KafkaNull and others. However if this was not the intention - * of the developer, this would be discovered early in the development process where the - * additional message converter could be added to facilitate the conversion. - */ - logger.info("Input type conversion of payload " + message.getPayload() + " resulted in 'null'. " - + "Will use the original message as input."); + if (logger.isDebugEnabled()) { + /* + * In the event conversion was unsuccessful we simply return the original un-converted message. + * This will help to deal with issues like KafkaNull and others. However if this was not the intention + * of the developer, this would be discovered early in the development process where the + * additional message converter could be added to facilitate the conversion. + */ + logger.debug("Input type conversion of payload " + message.getPayload() + " resulted in 'null'. " + + "Will use the original message as input."); + } + convertedInput = message; } else {