Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-09-23 14:16:52 +08:00
2 changed files with 42 additions and 38 deletions

View File

@@ -45,10 +45,10 @@ public class RequestLogAspect {
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
Object result = proceedingJoinPoint.proceed(); Object result = proceedingJoinPoint.proceed();
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
if (frameConfig.getShowControllerLog()) { if (frameConfig.getShowControllerLog()) {
RequestInfo requestInfo = new RequestInfo(); RequestInfo requestInfo = new RequestInfo();
requestInfo.setIp(request.getRemoteAddr()); requestInfo.setIp(request.getRemoteAddr());
@@ -61,12 +61,15 @@ public class RequestLogAspect {
requestInfo.setTimeCost(System.currentTimeMillis() - start); requestInfo.setTimeCost(System.currentTimeMillis() - start);
LOGGER.info("Request Info : {}", JSON.toJSONString(requestInfo)); LOGGER.info("Request Info : {}", JSON.toJSONString(requestInfo));
} }
}
return result; return result;
} }
@AfterThrowing(pointcut = "requestServer()", throwing = "e") @AfterThrowing(pointcut = "requestServer()", throwing = "e")
public void doAfterThrow(JoinPoint joinPoint, RuntimeException e) { public void doAfterThrow(JoinPoint joinPoint, RuntimeException e) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
RequestErrorInfo requestErrorInfo = new RequestErrorInfo(); RequestErrorInfo requestErrorInfo = new RequestErrorInfo();
requestErrorInfo.setIp(request.getRemoteAddr()); requestErrorInfo.setIp(request.getRemoteAddr());
@@ -78,6 +81,7 @@ public class RequestLogAspect {
requestErrorInfo.setException(e); requestErrorInfo.setException(e);
LOGGER.error("Error Request Info : {}", JSON.toJSONString(requestErrorInfo)); LOGGER.error("Error Request Info : {}", JSON.toJSONString(requestErrorInfo));
} }
}
/** /**
* 获取入参 * 获取入参

View File

@@ -230,25 +230,25 @@
</profile> </profile>
</profiles> </profiles>
<distributionManagement> <distributionManagement>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://192.168.0.123:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot</name>
<url>http://192.168.0.123:8081/repository/maven-snapshots/</url>
</snapshotRepository>
<!-- <repository>--> <!-- <repository>-->
<!-- <id>releases-hc</id>--> <!-- <id>releases</id>-->
<!-- <name>Releases</name>--> <!-- <name>Releases</name>-->
<!-- <url>https://qs.taixingyiji.com:8082/repository/maven-releases/</url>--> <!-- <url>http://192.168.0.123:8081/repository/maven-releases/</url>-->
<!-- </repository>--> <!-- </repository>-->
<!-- <snapshotRepository>--> <!-- <snapshotRepository>-->
<!-- <id>snapshots-hc</id>--> <!-- <id>snapshots</id>-->
<!-- <name>Snapshot</name>--> <!-- <name>Snapshot</name>-->
<!-- <url>https://qs.taixingyiji.com:8082/repository/maven-snapshots/</url>--> <!-- <url>http://192.168.0.123:8081/repository/maven-snapshots/</url>-->
<!-- </snapshotRepository>--> <!-- </snapshotRepository>-->
<repository>
<id>releases-hc</id>
<name>Releases</name>
<url>https://qs.taixingyiji.com:8082/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots-hc</id>
<name>Snapshot</name>
<url>https://qs.taixingyiji.com:8082/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement> </distributionManagement>
</project> </project>