@Component public class LogAspect extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private LogJsonParserFactory |
jsonParserFactory |
private static org.slf4j.Logger |
log |
private IOperationLogService |
operationLogService
操作日志服务
|
private static ThreadLocal<Long> |
TIME_THREADLOCAL
计算操作消耗时间
|
| 构造器和说明 |
|---|
LogAspect(IOperationLogService operationLogService,
LogJsonParserFactory jsonParserFactory) |
| 限定符和类型 | 方法和说明 |
|---|---|
private String |
argsArrayToString(Object[] paramsArray,
String[] excludeParamNames)
参数拼装
|
void |
doAfterReturning(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
Object result)
处理完请求后执行保存操作日志
|
void |
doAfterThrowing(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
Exception e)
拦截异常操作
|
void |
doBeforeProcessing(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog)
处理请求前执行
|
private String[] |
getExcludeProperties(String[] excludeParamNames)
获取忽略敏感属性
|
private void |
getLogAnnotationInformation(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
BaseLogEntity baseLogEntity,
Object result)
获取日志注释信息
|
boolean |
isFilterObject(Object o)
判断是否需要过滤的对象。
|
private void |
recordOperationLog(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
Exception e,
Object result)
设置系统日志基本参数数据
|
private void |
setRequestValue(org.aspectj.lang.JoinPoint joinPoint,
BaseLogEntity baseLogEntity,
String[] excludeParamNames)
获取请求的参数,放到baseLogEntity中
|
private static final org.slf4j.Logger log
private static final ThreadLocal<Long> TIME_THREADLOCAL
private final IOperationLogService operationLogService
private final LogJsonParserFactory jsonParserFactory
public LogAspect(IOperationLogService operationLogService, LogJsonParserFactory jsonParserFactory)
public void doBeforeProcessing(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog)
joinPoint - 连接点sysLog - 注解public void doAfterReturning(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
Object result)
joinPoint - 连接点result - 切入方法返回值public void doAfterThrowing(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
Exception e)
joinPoint - 连接点e - 异常private void recordOperationLog(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
Exception e,
Object result)
joinPoint - 连接点sysLog - 日志注解e - 异常result - 调用的方法返回结果private void getLogAnnotationInformation(org.aspectj.lang.JoinPoint joinPoint,
SysLog sysLog,
BaseLogEntity baseLogEntity,
Object result)
joinPoint - 连接点sysLog - 日志注解result - 调用的方法返回结果baseLogEntity - 日志对象private void setRequestValue(org.aspectj.lang.JoinPoint joinPoint,
BaseLogEntity baseLogEntity,
String[] excludeParamNames)
joinPoint - 连接点baseLogEntity - 日志基础对象excludeParamNames - 排除参数名称private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames)
paramsArray - 参数数组excludeParamNames - 排除参数名称Stringprivate String[] getExcludeProperties(String[] excludeParamNames)
excludeParamNames - 排除参数名称String[]public boolean isFilterObject(Object o)
o - 对象信息。Copyright © 2023. All rights reserved.