Improve debug logging at BeanDefinitionReader and BeanFactory level
Issue: SPR-17090
This commit is contained in:
@@ -157,8 +157,8 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
|
||||
@Override
|
||||
public Object getProxy(@Nullable ClassLoader classLoader) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating CGLIB proxy: target source is " + this.advised.getTargetSource());
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Creating CGLIB proxy: " + this.advised.getTargetSource());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -810,24 +810,28 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
@Override
|
||||
public int accept(Method method) {
|
||||
if (AopUtils.isFinalizeMethod(method)) {
|
||||
logger.debug("Found finalize() method - using NO_OVERRIDE");
|
||||
logger.trace("Found finalize() method - using NO_OVERRIDE");
|
||||
return NO_OVERRIDE;
|
||||
}
|
||||
if (!this.advised.isOpaque() && method.getDeclaringClass().isInterface() &&
|
||||
method.getDeclaringClass().isAssignableFrom(Advised.class)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Method is declared on Advised interface: " + method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Method is declared on Advised interface: " + method);
|
||||
}
|
||||
return DISPATCH_ADVISED;
|
||||
}
|
||||
// We must always proxy equals, to direct calls to this.
|
||||
if (AopUtils.isEqualsMethod(method)) {
|
||||
logger.debug("Found 'equals' method: " + method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Found 'equals' method: " + method);
|
||||
}
|
||||
return INVOKE_EQUALS;
|
||||
}
|
||||
// We must always calculate hashCode based on the proxy.
|
||||
if (AopUtils.isHashCodeMethod(method)) {
|
||||
logger.debug("Found 'hashCode' method: " + method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Found 'hashCode' method: " + method);
|
||||
}
|
||||
return INVOKE_HASHCODE;
|
||||
}
|
||||
Class<?> targetClass = this.advised.getTargetClass();
|
||||
@@ -840,8 +844,8 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
if (haveAdvice || !isFrozen) {
|
||||
// If exposing the proxy, then AOP_PROXY must be used.
|
||||
if (exposeProxy) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Must expose proxy on advised method: " + method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Must expose proxy on advised method: " + method);
|
||||
}
|
||||
return AOP_PROXY;
|
||||
}
|
||||
@@ -849,16 +853,16 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
// Check to see if we have fixed interceptor to serve this method.
|
||||
// Else use the AOP_PROXY.
|
||||
if (isStatic && isFrozen && this.fixedInterceptorMap.containsKey(key)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Method has advice and optimizations are enabled: " + method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Method has advice and optimizations are enabled: " + method);
|
||||
}
|
||||
// We know that we are optimizing so we can use the FixedStaticChainInterceptors.
|
||||
int index = this.fixedInterceptorMap.get(key);
|
||||
return (index + this.fixedInterceptorOffset);
|
||||
}
|
||||
else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Unable to apply any optimizations to advised method: " + method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Unable to apply any optimizations to advised method: " + method);
|
||||
}
|
||||
return AOP_PROXY;
|
||||
}
|
||||
@@ -874,15 +878,15 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
}
|
||||
Class<?> returnType = method.getReturnType();
|
||||
if (targetClass != null && returnType.isAssignableFrom(targetClass)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Method return type is assignable from target type and " +
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Method return type is assignable from target type and " +
|
||||
"may therefore return 'this' - using INVOKE_TARGET: " + method);
|
||||
}
|
||||
return INVOKE_TARGET;
|
||||
}
|
||||
else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Method return type ensures 'this' cannot be returned - " +
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Method return type ensures 'this' cannot be returned - " +
|
||||
"using DISPATCH_TARGET: " + method);
|
||||
}
|
||||
return DISPATCH_TARGET;
|
||||
|
||||
@@ -115,8 +115,8 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
|
||||
@Override
|
||||
public Object getProxy(@Nullable ClassLoader classLoader) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Creating JDK dynamic proxy: " + this.advised.getTargetSource());
|
||||
}
|
||||
Class<?>[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised, true);
|
||||
findDefinedEqualsAndHashCodeMethods(proxiedInterfaces);
|
||||
|
||||
@@ -136,8 +136,8 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
||||
exceptionClass = exceptionClass.getSuperclass();
|
||||
handler = this.exceptionHandlerMap.get(exceptionClass);
|
||||
}
|
||||
if (handler != null && logger.isDebugEnabled()) {
|
||||
logger.debug("Found handler for exception of type [" + exceptionClass.getName() + "]: " + handler);
|
||||
if (handler != null && logger.isTraceEnabled()) {
|
||||
logger.trace("Found handler for exception of type [" + exceptionClass.getName() + "]: " + handler);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user