diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/annotation/Log.java b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/annotation/Log.java
deleted file mode 100644
index c0521fd9..00000000
--- a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/annotation/Log.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
- *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.gnu.org/licenses/lgpl.html
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package top.continew.starter.log.aop.annotation;
-
-import top.continew.starter.log.core.enums.Include;
-
-import java.lang.annotation.*;
-
-/**
- * 日志注解
- *
用于接口方法或类上
- *
- * @author Charles7c
- * @since 1.1.0
- */
-@Documented
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Log {
-
- /**
- * 所属模块(用于接口方法或类上)
- */
- String module() default "";
-
- /**
- * 日志描述 - 接口操作内容(仅用于接口方法上)
- */
- String value() default "";
-
- /**
- * 包含信息(在全局配置基础上扩展包含信息)
- */
- Include[] includes() default {};
-
- /**
- * 排除信息(在全局配置基础上减少包含信息)
- */
- Include[] excludes() default {};
-}
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/aspect/ConsoleLogAspect.java b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/aspect/ConsoleLogAspect.java
deleted file mode 100644
index b9617b0a..00000000
--- a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/aspect/ConsoleLogAspect.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
- *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.gnu.org/licenses/lgpl.html
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package top.continew.starter.log.aop.aspect;
-
-import com.alibaba.ttl.TransmittableThreadLocal;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-import top.continew.starter.log.aop.autoconfigure.LogProperties;
-
-import java.time.Duration;
-import java.time.Instant;
-
-/**
- * 控制台 输出日志切面
- *
- * @author echo
- * @date 2024/12/06 10:33
- **/
-@Aspect
-public class ConsoleLogAspect {
-
- private static final Logger log = LoggerFactory.getLogger(ConsoleLogAspect.class);
- private final LogProperties logProperties;
- private final TransmittableThreadLocal timeTtl = new TransmittableThreadLocal<>();
-
- public ConsoleLogAspect(LogProperties logProperties) {
- this.logProperties = logProperties;
- }
-
- /**
- * 切点 - 匹配所有控制器层的方法
- */
- @Pointcut("execution(* *..controller.*.*(..)) || execution(* *..*Controller.*(..))")
- public void controllerLayer() {
- }
-
- /**
- * 处理请求前执行
- */
- @Before(value = "controllerLayer()")
- public void doBefore() {
- // 打印请求日志
- if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
- Instant startTime = Instant.now();
- ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
- if (attributes != null) {
- HttpServletRequest request = attributes.getRequest();
- log.info("[{}] {}", request.getMethod(), request.getRequestURI());
- }
- timeTtl.set(startTime);
- }
- }
-
- /**
- * 处理请求后执行
- */
- @After(value = "controllerLayer()")
- public void afterAdvice() {
- // 打印请求耗时
- if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
- Instant endTime = Instant.now();
- ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
- if (attributes == null) {
- return;
- }
- HttpServletRequest request = attributes.getRequest();
- HttpServletResponse response = attributes.getResponse();
- Duration timeTaken = Duration.between(timeTtl.get(), endTime);
- log.info("[{}] {} {} {}ms", request.getMethod(), request.getRequestURI(), response != null
- ? response.getStatus()
- : "N/A", timeTaken.toMillis());
- }
- }
-}
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aspect/AccessLogAspect.java b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aspect/AccessLogAspect.java
new file mode 100644
index 00000000..1d683824
--- /dev/null
+++ b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aspect/AccessLogAspect.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package top.continew.starter.log.aspect;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import top.continew.starter.log.autoconfigure.LogProperties;
+
+import java.time.Duration;
+import java.time.Instant;
+
+/**
+ * 访问日志切面
+ *
+ * @author echo
+ * @author Charles7c
+ * @since 2.8.0
+ */
+@Aspect
+public class AccessLogAspect {
+
+ private static final Logger log = LoggerFactory.getLogger(AccessLogAspect.class);
+ private final LogProperties logProperties;
+
+ public AccessLogAspect(LogProperties logProperties) {
+ this.logProperties = logProperties;
+ }
+
+ /**
+ * 切点 - 匹配所有控制器层的方法
+ */
+ @Pointcut("execution(* *..controller.*.*(..)) || execution(* *..*Controller.*(..))")
+ public void pointcut() {
+ }
+
+ /**
+ * 打印访问日志
+ *
+ * @param joinPoint 切点
+ * @return 返回结果
+ * @throws Throwable 异常
+ */
+ @Around("pointcut()")
+ public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+ Instant startTime = Instant.now();
+ // 非 Web 环境不记录
+ ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+ if (attributes == null) {
+ return joinPoint.proceed();
+ }
+ HttpServletRequest request = attributes.getRequest();
+ HttpServletResponse response = attributes.getResponse();
+ try {
+ // 打印请求日志
+ if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
+ log.info("[{}] {}", request.getMethod(), request.getRequestURI());
+ }
+ return joinPoint.proceed();
+ } finally {
+ Instant endTime = Instant.now();
+ if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
+ Duration timeTaken = Duration.between(startTime, endTime);
+ log.info("[{}] {} {} {}ms", request.getMethod(), request.getRequestURI(), response != null
+ ? response.getStatus()
+ : "N/A", timeTaken.toMillis());
+ }
+ }
+ }
+}
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/aspect/LogAspect.java b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aspect/LogAspect.java
similarity index 60%
rename from continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/aspect/LogAspect.java
rename to continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aspect/LogAspect.java
index f752c48b..931a1ffe 100644
--- a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/aspect/LogAspect.java
+++ b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aspect/LogAspect.java
@@ -14,27 +14,28 @@
* limitations under the License.
*/
-package top.continew.starter.log.aop.aspect;
+package top.continew.starter.log.aspect;
import cn.hutool.core.text.CharSequenceUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.ttl.TransmittableThreadLocal;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import top.continew.starter.log.aop.annotation.Log;
-import top.continew.starter.log.aop.autoconfigure.LogProperties;
-import top.continew.starter.log.core.dao.LogDao;
-import top.continew.starter.log.core.enums.Include;
-import top.continew.starter.log.core.http.recordable.impl.RecordableServletHttpRequest;
-import top.continew.starter.log.core.http.recordable.impl.RecordableServletHttpResponse;
-import top.continew.starter.log.core.model.LogRecord;
+import top.continew.starter.log.annotation.Log;
+import top.continew.starter.log.autoconfigure.LogProperties;
+import top.continew.starter.log.dao.LogDao;
+import top.continew.starter.log.enums.Include;
+import top.continew.starter.log.http.recordable.impl.RecordableServletHttpRequest;
+import top.continew.starter.log.http.recordable.impl.RecordableServletHttpResponse;
+import top.continew.starter.log.model.LogRecord;
import java.lang.reflect.Method;
import java.time.Instant;
@@ -45,16 +46,15 @@ import java.util.Set;
* 日志切面
*
* @author echo
- * @date 2024/12/06 09:58
- **/
+ * @author Charles7c
+ * @since 2.8.0
+ */
@Aspect
public class LogAspect {
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
private final LogDao logDao;
private final LogProperties logProperties;
- private final TransmittableThreadLocal timeTtl = new TransmittableThreadLocal<>();
- private final TransmittableThreadLocal logTtl = new TransmittableThreadLocal<>();
public LogAspect(LogDao logDao, LogProperties logProperties) {
this.logDao = logDao;
@@ -64,104 +64,93 @@ public class LogAspect {
/**
* 切点 - 匹配日志注解 {@link Log}
*/
- @Pointcut(value = "@annotation(top.continew.starter.log.aop.annotation.Log)")
- public void pointcutService() {
+ @Pointcut("@annotation(top.continew.starter.log.annotation.Log)")
+ public void pointcut() {
}
/**
- * 处理请求前执行
+ * 记录日志
+ *
+ * @param joinPoint 切点
+ * @return 返回结果
+ * @throws Throwable 异常
*/
- @Before(value = "pointcutService()")
- public void doBefore() {
+ @Around("pointcut()")
+ public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
Instant startTime = Instant.now();
+ // 非 Web 环境不记录
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
- if (attributes != null) {
- HttpServletRequest request = attributes.getRequest();
- LogRecord.Started startedLogRecord = LogRecord.start(startTime, new RecordableServletHttpRequest(request));
- logTtl.set(startedLogRecord);
+ if (attributes == null || attributes.getResponse() == null) {
+ return joinPoint.proceed();
+ }
+ HttpServletRequest request = attributes.getRequest();
+ HttpServletResponse response = attributes.getResponse();
+ String errorMsg = null;
+ // 开始记录
+ LogRecord.Started startedLogRecord = LogRecord.start(startTime, new RecordableServletHttpRequest(request));
+ try {
+ // 执行目标方法
+ return joinPoint.proceed();
+ } catch (Exception e) {
+ errorMsg = CharSequenceUtil.sub(e.getMessage(), 0, 2000);
+ throw e;
+ } finally {
+ // 结束记录
+ this.logFinish(startedLogRecord, errorMsg, response, joinPoint);
}
}
/**
- * 处理请求后执行 - 正常返回
+ * 结束记录日志
*
- * @param joinPoint 切点
+ * @param startedLogRecord 日志记录器
+ * @param errorMsg 异常信息
+ * @param response 响应对象
+ * @param joinPoint 切点
*/
- @After(value = "pointcutService()")
- public void afterAdvice(JoinPoint joinPoint) {
- handleAfterCompletion(joinPoint, null);
- }
-
- /**
- * 处理请求后执行 - 异常情况
- *
- * @param joinPoint 切点
- * @param ex 异常
- */
- @AfterThrowing(pointcut = "pointcutService()", throwing = "ex")
- public void afterThrowing(JoinPoint joinPoint, Exception ex) {
- handleAfterCompletion(joinPoint, ex);
- }
-
- /**
- * 处理请求完成后的逻辑
- *
- * @param joinPoint 切点
- * @param ex 异常
- * @param result 返回结果
- */
- private void handleAfterCompletion(JoinPoint joinPoint, Exception ex) {
+ private void logFinish(LogRecord.Started startedLogRecord,
+ String errorMsg,
+ HttpServletResponse response,
+ ProceedingJoinPoint joinPoint) {
try {
Instant endTime = Instant.now();
- ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
- if (attributes == null) {
- return;
- }
- HttpServletResponse response = attributes.getResponse();
- // 处理日志记录
- LogRecord.Started startedLogRecord = logTtl.get();
- if (startedLogRecord == null) {
- return;
- }
-
- // 获取方法和类注解信息
- MethodSignature signature = (MethodSignature)joinPoint.getSignature();
- Method method = signature.getMethod();
+ Method method = this.getMethod(joinPoint);
Class> targetClass = joinPoint.getTarget().getClass();
-
Log methodLog = method.getAnnotation(Log.class);
Log classLog = targetClass.getAnnotation(Log.class);
-
- // 获取日志包含信息
- Set includeSet = getIncludes(methodLog, classLog);
-
- // 完成日志记录
+ Set includeSet = this.getIncludes(methodLog, classLog);
LogRecord finishedLogRecord = startedLogRecord
.finish(endTime, new RecordableServletHttpResponse(response, response.getStatus()), includeSet);
- // 记录异常
- if (ex != null) {
- finishedLogRecord.getResponse().setStatus(1);
- finishedLogRecord.setErrorMsg(StrUtil.sub(ex.getMessage(), 0, 2000));
+ // 记录异常信息
+ if (errorMsg != null) {
+ finishedLogRecord.setErrorMsg(errorMsg);
}
-
// 记录日志描述
if (includeSet.contains(Include.DESCRIPTION)) {
- logDescription(finishedLogRecord, methodLog);
+ this.logDescription(finishedLogRecord, methodLog);
}
-
// 记录所属模块
if (includeSet.contains(Include.MODULE)) {
- logModule(finishedLogRecord, methodLog, classLog);
+ this.logModule(finishedLogRecord, methodLog, classLog);
}
logDao.add(finishedLogRecord);
} catch (Exception e) {
log.error("Logging http log occurred an error: {}.", e.getMessage(), e);
- } finally {
- timeTtl.remove();
- logTtl.remove();
+ throw e;
}
}
+ /**
+ * 获取方法
+ *
+ * @param joinPoint 切点
+ * @return 方法
+ */
+ private Method getMethod(JoinPoint joinPoint) {
+ MethodSignature signature = (MethodSignature)joinPoint.getSignature();
+ return signature.getMethod();
+ }
+
/**
* 获取日志包含信息
*
@@ -204,7 +193,7 @@ public class LogAspect {
* @param methodLog 方法级 Log 注解
*/
private void logDescription(LogRecord logRecord, Log methodLog) {
- // 如果方法注解存在日志描述
+ // 例如:@Log("新增部门") -> 新增部门
if (null != methodLog && CharSequenceUtil.isNotBlank(methodLog.value())) {
logRecord.setDescription(methodLog.value());
} else {
@@ -220,12 +209,12 @@ public class LogAspect {
* @param classLog 类级 Log 注解
*/
private void logModule(LogRecord logRecord, Log methodLog, Log classLog) {
+ // 例如:@Log(module = "部门管理") -> 部门管理
// 优先使用方法注解的模块
if (null != methodLog && CharSequenceUtil.isNotBlank(methodLog.module())) {
logRecord.setModule(methodLog.module());
return;
}
-
// 其次使用类注解的模块
if (null != classLog) {
logRecord.setModule(CharSequenceUtil.blankToDefault(classLog.module(), "请在该接口类上指定所属模块"));
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/autoconfigure/LogAutoConfiguration.java b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java
similarity index 75%
rename from continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/autoconfigure/LogAutoConfiguration.java
rename to continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java
index 9ed58284..89c9a1fc 100644
--- a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/autoconfigure/LogAutoConfiguration.java
+++ b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.aop.autoconfigure;
+package top.continew.starter.log.autoconfigure;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
@@ -24,16 +24,17 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import top.continew.starter.log.aop.annotation.ConditionalOnEnabledLog;
-import top.continew.starter.log.aop.aspect.ConsoleLogAspect;
-import top.continew.starter.log.aop.aspect.LogAspect;
-import top.continew.starter.log.core.dao.LogDao;
-import top.continew.starter.log.core.dao.impl.LogDaoDefaultImpl;
+import top.continew.starter.log.annotation.ConditionalOnEnabledLog;
+import top.continew.starter.log.aspect.AccessLogAspect;
+import top.continew.starter.log.aspect.LogAspect;
+import top.continew.starter.log.dao.LogDao;
+import top.continew.starter.log.dao.impl.DefaultLogDaoImpl;
/**
* 日志自动配置
*
* @author Charles7c
+ * @author echo
* @since 1.1.0
*/
@Configuration
@@ -50,25 +51,25 @@ public class LogAutoConfiguration {
}
/**
- * 记录日志切面
+ * 日志切面
*
* @return {@link LogAspect }
*/
@Bean
@ConditionalOnMissingBean
- public LogAspect logAspect() {
- return new LogAspect(logDao(), logProperties);
+ public LogAspect logAspect(LogDao logDao) {
+ return new LogAspect(logDao, logProperties);
}
/**
- * 控制台输出日志切面
+ * 访问日志切面
*
* @return {@link LogAspect }
*/
@Bean
@ConditionalOnMissingBean
- public ConsoleLogAspect consoleLogAspect() {
- return new ConsoleLogAspect(logProperties);
+ public AccessLogAspect accessLogAspect() {
+ return new AccessLogAspect(logProperties);
}
/**
@@ -77,11 +78,11 @@ public class LogAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public LogDao logDao() {
- return new LogDaoDefaultImpl();
+ return new DefaultLogDaoImpl();
}
@PostConstruct
public void postConstruct() {
- log.debug("[ContiNew Starter] - Auto Configuration 'Log-aop' completed initialization.");
+ log.debug("[ContiNew Starter] - Auto Configuration 'Log-AOP' completed initialization.");
}
}
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/autoconfigure/LogProperties.java b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/autoconfigure/LogProperties.java
similarity index 94%
rename from continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/autoconfigure/LogProperties.java
rename to continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/autoconfigure/LogProperties.java
index 8acb8dae..a168fe7a 100644
--- a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/autoconfigure/LogProperties.java
+++ b/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/autoconfigure/LogProperties.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package top.continew.starter.log.aop.autoconfigure;
+package top.continew.starter.log.autoconfigure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import top.continew.starter.core.constant.PropertiesConstants;
-import top.continew.starter.log.core.enums.Include;
+import top.continew.starter.log.enums.Include;
import java.util.Set;
@@ -26,6 +26,7 @@ import java.util.Set;
* 日志配置属性
*
* @author Charles7c
+ * @author echo
* @since 1.1.0
*/
@ConfigurationProperties(PropertiesConstants.LOG)
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/continew-starter-log/continew-starter-log-aop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 5ee12e4c..fdf6dbc5 100644
--- a/continew-starter-log/continew-starter-log-aop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ b/continew-starter-log/continew-starter-log-aop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1 +1 @@
-top.continew.starter.log.aop.autoconfigure.LogAutoConfiguration
\ No newline at end of file
+top.continew.starter.log.autoconfigure.LogAutoConfiguration
\ No newline at end of file
diff --git a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/annotation/ConditionalOnEnabledLog.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/annotation/ConditionalOnEnabledLog.java
similarity index 95%
rename from continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/annotation/ConditionalOnEnabledLog.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/annotation/ConditionalOnEnabledLog.java
index a0a973a5..1e000429 100644
--- a/continew-starter-log/continew-starter-log-aop/src/main/java/top/continew/starter/log/aop/annotation/ConditionalOnEnabledLog.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/annotation/ConditionalOnEnabledLog.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.aop.annotation;
+package top.continew.starter.log.annotation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import top.continew.starter.core.constant.PropertiesConstants;
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/annotation/Log.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/annotation/Log.java
similarity index 94%
rename from continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/annotation/Log.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/annotation/Log.java
index 60bdff26..e26b8421 100644
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/annotation/Log.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/annotation/Log.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package top.continew.starter.log.interceptor.annotation;
+package top.continew.starter.log.annotation;
-import top.continew.starter.log.core.enums.Include;
+import top.continew.starter.log.enums.Include;
import java.lang.annotation.*;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/dao/LogDao.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/dao/LogDao.java
similarity index 91%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/dao/LogDao.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/dao/LogDao.java
index f305e677..c2b48f2a 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/dao/LogDao.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/dao/LogDao.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.dao;
+package top.continew.starter.log.dao;
-import top.continew.starter.log.core.model.LogRecord;
+import top.continew.starter.log.model.LogRecord;
import java.util.Collections;
import java.util.List;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/dao/impl/LogDaoDefaultImpl.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/dao/impl/DefaultLogDaoImpl.java
similarity index 91%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/dao/impl/LogDaoDefaultImpl.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/dao/impl/DefaultLogDaoImpl.java
index 8471456b..81c43565 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/dao/impl/LogDaoDefaultImpl.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/dao/impl/DefaultLogDaoImpl.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.dao.impl;
+package top.continew.starter.log.dao.impl;
-import top.continew.starter.log.core.dao.LogDao;
-import top.continew.starter.log.core.model.LogRecord;
+import top.continew.starter.log.dao.LogDao;
+import top.continew.starter.log.model.LogRecord;
import java.util.LinkedList;
import java.util.List;
@@ -30,7 +30,7 @@ import java.util.List;
* @author Charles7c
* @since 1.1.0
*/
-public class LogDaoDefaultImpl implements LogDao {
+public class DefaultLogDaoImpl implements LogDao {
/**
* 容量
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/enums/Include.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/enums/Include.java
similarity index 98%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/enums/Include.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/enums/Include.java
index 0b2f83af..4a050a9b 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/enums/Include.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/enums/Include.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.enums;
+package top.continew.starter.log.enums;
import java.util.Collections;
import java.util.LinkedHashSet;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/RecordableHttpRequest.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/RecordableHttpRequest.java
similarity index 96%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/RecordableHttpRequest.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/RecordableHttpRequest.java
index 914dbc0d..9a086685 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/RecordableHttpRequest.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/RecordableHttpRequest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.http.recordable;
+package top.continew.starter.log.http.recordable;
import java.net.URI;
import java.util.Map;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/RecordableHttpResponse.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/RecordableHttpResponse.java
similarity index 95%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/RecordableHttpResponse.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/RecordableHttpResponse.java
index 28253ce4..b905e880 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/RecordableHttpResponse.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/RecordableHttpResponse.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.http.recordable;
+package top.continew.starter.log.http.recordable;
import java.util.Map;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/impl/RecordableServletHttpRequest.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/impl/RecordableServletHttpRequest.java
similarity index 96%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/impl/RecordableServletHttpRequest.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/impl/RecordableServletHttpRequest.java
index 775dbd0a..3630ed75 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/impl/RecordableServletHttpRequest.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/impl/RecordableServletHttpRequest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.http.recordable.impl;
+package top.continew.starter.log.http.recordable.impl;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
@@ -25,7 +25,7 @@ import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.UriUtils;
import org.springframework.web.util.WebUtils;
import top.continew.starter.core.constant.StringConstants;
-import top.continew.starter.log.core.http.recordable.RecordableHttpRequest;
+import top.continew.starter.log.http.recordable.RecordableHttpRequest;
import java.net.URI;
import java.net.URISyntaxException;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/impl/RecordableServletHttpResponse.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/impl/RecordableServletHttpResponse.java
similarity index 94%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/impl/RecordableServletHttpResponse.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/impl/RecordableServletHttpResponse.java
index c9cdccad..698dbda7 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/http/recordable/impl/RecordableServletHttpResponse.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/recordable/impl/RecordableServletHttpResponse.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.http.recordable.impl;
+package top.continew.starter.log.http.recordable.impl;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
@@ -22,7 +22,7 @@ import cn.hutool.json.JSONUtil;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.util.ContentCachingResponseWrapper;
import org.springframework.web.util.WebUtils;
-import top.continew.starter.log.core.http.recordable.RecordableHttpResponse;
+import top.continew.starter.log.http.recordable.RecordableHttpResponse;
import top.continew.starter.web.util.ServletUtils;
import java.util.Map;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogRecord.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRecord.java
similarity index 91%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogRecord.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRecord.java
index b86b6599..935e08a1 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogRecord.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRecord.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.model;
+package top.continew.starter.log.model;
-import top.continew.starter.log.core.enums.Include;
-import top.continew.starter.log.core.http.recordable.RecordableHttpRequest;
-import top.continew.starter.log.core.http.recordable.RecordableHttpResponse;
+import top.continew.starter.log.enums.Include;
+import top.continew.starter.log.http.recordable.RecordableHttpRequest;
+import top.continew.starter.log.http.recordable.RecordableHttpResponse;
import java.time.Duration;
import java.time.Instant;
@@ -115,9 +115,9 @@ public class LogRecord {
/**
* 结束日志记录
*
- * @param clock 时间
- * @param response 响应信息
- * @param includes 包含信息
+ * @param timestamp 结束时间
+ * @param response 响应信息
+ * @param includes 包含信息
* @return 日志记录
*/
public LogRecord finish(Instant timestamp, RecordableHttpResponse response, Set includes) {
@@ -172,11 +172,11 @@ public class LogRecord {
return timestamp;
}
- public String getErrorMsg() {
- return errorMsg;
- }
-
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
+
+ public String getErrorMsg() {
+ return errorMsg;
+ }
}
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogRequest.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java
similarity index 96%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogRequest.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java
index 2fdf58c2..19122cda 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogRequest.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.model;
+package top.continew.starter.log.model;
import cn.hutool.core.text.CharSequenceUtil;
import org.springframework.http.HttpHeaders;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.util.IpUtils;
-import top.continew.starter.log.core.enums.Include;
-import top.continew.starter.log.core.http.recordable.RecordableHttpRequest;
+import top.continew.starter.log.enums.Include;
+import top.continew.starter.log.http.recordable.RecordableHttpRequest;
import top.continew.starter.web.util.ServletUtils;
import java.net.URI;
diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogResponse.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogResponse.java
similarity index 92%
rename from continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogResponse.java
rename to continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogResponse.java
index cf6ef7bf..7c2dd026 100644
--- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/core/model/LogResponse.java
+++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogResponse.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package top.continew.starter.log.core.model;
+package top.continew.starter.log.model;
-import top.continew.starter.log.core.enums.Include;
-import top.continew.starter.log.core.http.recordable.RecordableHttpResponse;
+import top.continew.starter.log.enums.Include;
+import top.continew.starter.log.http.recordable.RecordableHttpResponse;
import java.util.Map;
import java.util.Set;
diff --git a/continew-starter-log/continew-starter-log-interceptor/pom.xml b/continew-starter-log/continew-starter-log-interceptor/pom.xml
index 40f0b564..8f96ceaf 100644
--- a/continew-starter-log/continew-starter-log-interceptor/pom.xml
+++ b/continew-starter-log/continew-starter-log-interceptor/pom.xml
@@ -10,7 +10,7 @@
continew-starter-log-interceptor
- ContiNew Starter 日志模块 - 拦截器版(Spring Boot Actuator HttpTrace 增强版)
+ ContiNew Starter 日志模块 - 基于拦截器实现(Spring Boot Actuator HttpTrace 增强版)
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/autoconfigure/LogAutoConfiguration.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java
similarity index 83%
rename from continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/autoconfigure/LogAutoConfiguration.java
rename to continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java
index 87f284f9..5243476e 100644
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/autoconfigure/LogAutoConfiguration.java
+++ b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.interceptor.autoconfigure;
+package top.continew.starter.log.autoconfigure;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
@@ -26,11 +26,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import top.continew.starter.log.core.dao.LogDao;
-import top.continew.starter.log.core.dao.impl.LogDaoDefaultImpl;
-import top.continew.starter.log.interceptor.annotation.ConditionalOnEnabledLog;
-import top.continew.starter.log.interceptor.handler.LogFilter;
-import top.continew.starter.log.interceptor.handler.LogInterceptor;
+import top.continew.starter.log.dao.LogDao;
+import top.continew.starter.log.dao.impl.DefaultLogDaoImpl;
+import top.continew.starter.log.annotation.ConditionalOnEnabledLog;
+import top.continew.starter.log.handler.LogFilter;
+import top.continew.starter.log.handler.LogInterceptor;
/**
* 日志自动配置
@@ -71,11 +71,11 @@ public class LogAutoConfiguration implements WebMvcConfigurer {
@Bean
@ConditionalOnMissingBean
public LogDao logDao() {
- return new LogDaoDefaultImpl();
+ return new DefaultLogDaoImpl();
}
@PostConstruct
public void postConstruct() {
- log.debug("[ContiNew Starter] - Auto Configuration 'Log-interceptor' completed initialization.");
+ log.debug("[ContiNew Starter] - Auto Configuration 'Log-Interceptor' completed initialization.");
}
}
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/autoconfigure/LogProperties.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogProperties.java
similarity index 95%
rename from continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/autoconfigure/LogProperties.java
rename to continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogProperties.java
index 96c356ec..ce497392 100644
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/autoconfigure/LogProperties.java
+++ b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogProperties.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package top.continew.starter.log.interceptor.autoconfigure;
+package top.continew.starter.log.autoconfigure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import top.continew.starter.core.constant.PropertiesConstants;
-import top.continew.starter.log.core.enums.Include;
+import top.continew.starter.log.enums.Include;
import top.continew.starter.web.util.SpringWebUtils;
import java.util.ArrayList;
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/handler/LogFilter.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/handler/LogFilter.java
similarity index 97%
rename from continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/handler/LogFilter.java
rename to continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/handler/LogFilter.java
index d46a0d98..cae13ac9 100644
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/handler/LogFilter.java
+++ b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/handler/LogFilter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.interceptor.handler;
+package top.continew.starter.log.handler;
import cn.hutool.extra.spring.SpringUtil;
import jakarta.servlet.FilterChain;
@@ -28,7 +28,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
import org.springframework.web.util.WebUtils;
-import top.continew.starter.log.interceptor.autoconfigure.LogProperties;
+import top.continew.starter.log.autoconfigure.LogProperties;
import java.io.IOException;
import java.net.URI;
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/handler/LogInterceptor.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/handler/LogInterceptor.java
similarity index 94%
rename from continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/handler/LogInterceptor.java
rename to continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/handler/LogInterceptor.java
index 512dceb2..9beb12d3 100644
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/handler/LogInterceptor.java
+++ b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/handler/LogInterceptor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.log.interceptor.handler;
+package top.continew.starter.log.handler;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.ttl.TransmittableThreadLocal;
@@ -28,13 +28,13 @@ import org.slf4j.LoggerFactory;
import org.springframework.lang.NonNull;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
-import top.continew.starter.log.core.http.recordable.impl.RecordableServletHttpRequest;
-import top.continew.starter.log.core.http.recordable.impl.RecordableServletHttpResponse;
-import top.continew.starter.log.interceptor.annotation.Log;
-import top.continew.starter.log.core.dao.LogDao;
-import top.continew.starter.log.core.enums.Include;
-import top.continew.starter.log.core.model.LogRecord;
-import top.continew.starter.log.interceptor.autoconfigure.LogProperties;
+import top.continew.starter.log.http.recordable.impl.RecordableServletHttpRequest;
+import top.continew.starter.log.http.recordable.impl.RecordableServletHttpResponse;
+import top.continew.starter.log.annotation.Log;
+import top.continew.starter.log.dao.LogDao;
+import top.continew.starter.log.enums.Include;
+import top.continew.starter.log.model.LogRecord;
+import top.continew.starter.log.autoconfigure.LogProperties;
import java.time.Duration;
import java.time.Instant;
@@ -109,6 +109,7 @@ public class LogInterceptor implements HandlerInterceptor {
logDao.add(finishedLogRecord);
} catch (Exception ex) {
log.error("Logging http log occurred an error: {}.", ex.getMessage(), ex);
+ throw ex;
} finally {
timeTtl.remove();
logTtl.remove();
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/annotation/ConditionalOnEnabledLog.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/annotation/ConditionalOnEnabledLog.java
deleted file mode 100644
index 80246c8f..00000000
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/annotation/ConditionalOnEnabledLog.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
- *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.gnu.org/licenses/lgpl.html
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package top.continew.starter.log.interceptor.annotation;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import top.continew.starter.core.constant.PropertiesConstants;
-
-import java.lang.annotation.*;
-
-/**
- * 是否启用日志记录注解
- *
- * @author Charles7c
- * @since 1.1.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Documented
-@ConditionalOnProperty(prefix = PropertiesConstants.LOG, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
-public @interface ConditionalOnEnabledLog {
-}
\ No newline at end of file
diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/continew-starter-log/continew-starter-log-interceptor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 2304f8f4..fdf6dbc5 100644
--- a/continew-starter-log/continew-starter-log-interceptor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ b/continew-starter-log/continew-starter-log-interceptor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1 +1 @@
-top.continew.starter.log.interceptor.autoconfigure.LogAutoConfiguration
\ No newline at end of file
+top.continew.starter.log.autoconfigure.LogAutoConfiguration
\ No newline at end of file