From 3109ac4bef4bb34dc4910bc4105c114e0072f763 Mon Sep 17 00:00:00 2001 From: Eric Zhao Date: Fri, 25 Jan 2019 16:59:54 +0800 Subject: [PATCH] Remove slf4j dependency in sentinel-annotation-aspectj Signed-off-by: Eric Zhao --- .../sentinel-annotation-aspectj/pom.xml | 6 ------ .../aspectj/AbstractSentinelAspectSupport.java | 11 +++++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sentinel-extension/sentinel-annotation-aspectj/pom.xml b/sentinel-extension/sentinel-annotation-aspectj/pom.xml index e43d6413..1de4c600 100644 --- a/sentinel-extension/sentinel-annotation-aspectj/pom.xml +++ b/sentinel-extension/sentinel-annotation-aspectj/pom.xml @@ -32,12 +32,6 @@ aspectjweaver ${aspectj.version} - - - org.slf4j - slf4j-api - 1.7.25 - \ No newline at end of file diff --git a/sentinel-extension/sentinel-annotation-aspectj/src/main/java/com/alibaba/csp/sentinel/annotation/aspectj/AbstractSentinelAspectSupport.java b/sentinel-extension/sentinel-annotation-aspectj/src/main/java/com/alibaba/csp/sentinel/annotation/aspectj/AbstractSentinelAspectSupport.java index 5aacf89e..fe72e4f7 100644 --- a/sentinel-extension/sentinel-annotation-aspectj/src/main/java/com/alibaba/csp/sentinel/annotation/aspectj/AbstractSentinelAspectSupport.java +++ b/sentinel-extension/sentinel-annotation-aspectj/src/main/java/com/alibaba/csp/sentinel/annotation/aspectj/AbstractSentinelAspectSupport.java @@ -16,6 +16,7 @@ package com.alibaba.csp.sentinel.annotation.aspectj; import com.alibaba.csp.sentinel.annotation.SentinelResource; +import com.alibaba.csp.sentinel.log.RecordLog; import com.alibaba.csp.sentinel.slots.block.BlockException; import com.alibaba.csp.sentinel.slots.block.degrade.DegradeException; import com.alibaba.csp.sentinel.util.MethodUtil; @@ -23,8 +24,6 @@ import com.alibaba.csp.sentinel.util.StringUtil; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.reflect.MethodSignature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -32,11 +31,11 @@ import java.util.Arrays; /** * Some common functions for Sentinel annotation aspect. + * + * @author Eric Zhao */ public abstract class AbstractSentinelAspectSupport { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - protected String getResourceName(String resourceName, Method method) { // If resource name is present in annotation, use this value. if (StringUtil.isNotBlank(resourceName)) { @@ -154,7 +153,7 @@ public abstract class AbstractSentinelAspectSupport { && returnType.isAssignableFrom(method.getReturnType()) && Arrays.equals(parameterTypes, method.getParameterTypes())) { - logger.info("Resolved method [{}] in class [{}]", name, clazz.getCanonicalName()); + RecordLog.info("Resolved method [{0}] in class [{1}]", name, clazz.getCanonicalName()); return method; } } @@ -164,7 +163,7 @@ public abstract class AbstractSentinelAspectSupport { return findMethod(mustStatic, superClass, name, returnType, parameterTypes); } else { String methodType = mustStatic ? " static" : ""; - logger.error("Cannot find{} method [{}] in class [{}] with parameters {}", + RecordLog.warn("Cannot find{0} method [{1}] in class [{2}] with parameters {3}", methodType, name, clazz.getCanonicalName(), Arrays.toString(parameterTypes)); return null; }