diff --git a/src/main/java/app/annotations/impl/CollectStatisticAspect.java b/src/main/java/app/annotations/impl/CollectStatisticAspect.java index 24b9d09..dbbd01d 100644 --- a/src/main/java/app/annotations/impl/CollectStatisticAspect.java +++ b/src/main/java/app/annotations/impl/CollectStatisticAspect.java @@ -34,8 +34,6 @@ public class CollectStatisticAspect { @Before("@annotation(app.annotations.interfaces.CollectStatistic)") public void before() { - CollectableStatistic st = new CollectableStatistic(request); - collectStatisticService.add(st); - logger.info(st.toString()); + collectStatisticService.add(new CollectableStatistic(request)); } } diff --git a/src/main/java/app/entities/db/CollectableStatistic.java b/src/main/java/app/entities/db/CollectableStatistic.java index 6e3de3c..f556bc8 100644 --- a/src/main/java/app/entities/db/CollectableStatistic.java +++ b/src/main/java/app/entities/db/CollectableStatistic.java @@ -24,6 +24,7 @@ public class CollectableStatistic { public CollectableStatistic(HttpServletRequest request) { this.client_ip = request.getHeader("X-Forwarded-For"); + if (this.client_ip != null) this.client_ip = this.client_ip.split(",")[0]; this.method = request.getMethod(); this.path = request.getRequestURI(); this.query = request.getQueryString();