|
@ -13,19 +13,20 @@ |
|
|
* See the License for the specific language governing permissions and |
|
|
* See the License for the specific language governing permissions and |
|
|
* limitations under the License. |
|
|
* limitations under the License. |
|
|
*/ |
|
|
*/ |
|
|
package org.nl.common.domain.aspect; |
|
|
package org.nl.common.logging.aspect; |
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import io.netty.util.internal.ThrowableUtil; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.aspectj.lang.ProceedingJoinPoint; |
|
|
import org.aspectj.lang.ProceedingJoinPoint; |
|
|
import org.aspectj.lang.annotation.Around; |
|
|
import org.aspectj.lang.annotation.Around; |
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
import org.aspectj.lang.reflect.MethodSignature; |
|
|
import org.aspectj.lang.reflect.MethodSignature; |
|
|
import org.nl.common.utils.*; |
|
|
import org.nl.common.utils.IPUtil; |
|
|
|
|
|
import org.nl.common.utils.IdUtil; |
|
|
|
|
|
import org.nl.common.utils.RequestHolder; |
|
|
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
import org.nl.config.lucene.LuceneAppender; |
|
|
import org.nl.config.lucene.LuceneAppender; |
|
|
import org.slf4j.MDC; |
|
|
import org.slf4j.MDC; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
@ -58,6 +59,7 @@ public class LogAspect { |
|
|
*/ |
|
|
*/ |
|
|
@Around("@annotation(logInfo)") |
|
|
@Around("@annotation(logInfo)") |
|
|
public Object logAround(ProceedingJoinPoint joinPoint,org.nl.common.logging.annotation.Log logInfo) throws Throwable { |
|
|
public Object logAround(ProceedingJoinPoint joinPoint,org.nl.common.logging.annotation.Log logInfo) throws Throwable { |
|
|
|
|
|
|
|
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|
|
Method method = signature.getMethod(); |
|
|
Method method = signature.getMethod(); |
|
|
String params = getParameter(method, joinPoint.getArgs()); |
|
|
String params = getParameter(method, joinPoint.getArgs()); |
|
@ -72,6 +74,11 @@ public class LogAspect { |
|
|
try { |
|
|
try { |
|
|
log.info("[--request--][请求接口:{}][请求参数:{}]",url,params); |
|
|
log.info("[--request--][请求接口:{}][请求参数:{}]",url,params); |
|
|
result = joinPoint.proceed(); |
|
|
result = joinPoint.proceed(); |
|
|
|
|
|
// //是否把日志存到日志表
|
|
|
|
|
|
// if (logInfo.isAddLogTable()) {
|
|
|
|
|
|
// Log log = new Log("INFO", System.currentTimeMillis() - comming);
|
|
|
|
|
|
// logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
|
|
|
|
|
|
// }
|
|
|
}catch (Exception ex){ |
|
|
}catch (Exception ex){ |
|
|
|
|
|
|
|
|
StringBuffer errorStack = new StringBuffer(); |
|
|
StringBuffer errorStack = new StringBuffer(); |
|
|