GH-592 Logging improvements in SimpleFunctionRegistry

This commit is contained in:
Oleg Zhurakousky
2020-11-09 19:48:22 +01:00
parent 746ce3fbce
commit 733f196cf6

View File

@@ -93,7 +93,7 @@ import org.springframework.util.StringUtils;
*/
public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspector {
Log logger = LogFactory.getLog(SimpleFunctionRegistry.class);
Log logger = LogFactory.getLog(this.getClass());
/**
* Identifies MessageConversionExceptions that happen when input can't be converted.
@@ -298,16 +298,20 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
for (String name : names) {
Object function = this.locateFunction(name);
if (function == null) {
logger.debug("Failed to discover function '" + definition + "' in function catalog. "
+ "Function available in catalog are: " + this.getNames(null) + ". This is generally "
+ "acceptable for cases where there was no intention to use functions.");
if (logger.isDebugEnabled()) {
logger.debug("Failed to discover function '" + definition + "' in function catalog. "
+ "Function available in catalog are: " + this.getNames(null) + ". This is generally "
+ "acceptable for cases where there was no intention to use functions.");
}
return null;
}
else {
Type functionType = this.discoverFunctionTypeByName(name);
if (functionType != null && functionType.toString().contains("org.apache.kafka.streams.")) {
logger
.debug("Kafka Streams function '" + definition + "' is not supported by spring-cloud-function.");
if (logger.isDebugEnabled()) {
logger.debug("Kafka Streams function '" + definition + "' is not supported by spring-cloud-function.");
}
return null;
}
}
@@ -564,8 +568,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
}
if (!(this.target instanceof Consumer) && logger.isDebugEnabled()) {
logger
.debug("Result of invocation of \"" + this.functionDefinition + "\" function is '" + invocationResult + "'");
logger.debug("Result of invocation of \"" + this.functionDefinition + "\" function is '" + invocationResult + "'");
}
if (!(invocationResult instanceof Message)) {
if (incomingMessage != null && invocationResult != null && incomingMessage.getHeaders().containsKey("scf-func-name")) {