From 98efb893d02ff95c4e49d6c5ec52f44459c5661a Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 22 Sep 2022 21:17:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=9F=E5=8F=B0=E6=B3=A8=E9=87=8A=E6=8E=89?= =?UTF-8?q?=20loglevel=20=E4=BF=AE=E6=94=B9=E7=8E=AF=E5=A2=83=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E7=9A=84=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/commons/tools/enums/EnvEnum.java | 10 +++++----- .../epmet/commons/tools/filter/LogMsgSendFilter.java | 12 ++---------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java index d514860a73..101bd38cbe 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java @@ -16,11 +16,11 @@ public enum EnvEnum { /** * 环境变量枚举 */ - LOCAL("local", "烟台-本地环境", "http://localhost:8080/api/"), - DEV("dev", "烟台-开发环境", "http://192.168.1.140:8080/api/"), - TEST("test", "烟台-体验环境", "https://epmet-dev.elinkservice.cn/api/"), - PROD("prod", "烟台-生产环境", "https://epmet-yantai.elinkservice.cn/api/"), - UN_KNOWN("un_known", "烟台-未知", "https://epmet-dev.elinkservice.cn/api/"), + LOCAL("local", "烟台政务-本地环境", "http://localhost:8080/api/"), + DEV("dev", "烟台政务-开发环境", "http://192.168.1.140:8080/api/"), + TEST("test", "烟台政务-体验环境", "https://epmet-dev.elinkservice.cn/api/"), + PROD("prod", "烟台政务-生产环境", "http://10.2.2.50:80/api/"), + UN_KNOWN("un_known", "烟台政务-未知", "https://epmet-dev.elinkservice.cn/api/"), ; private String code; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 9164f6d142..e363b7cd30 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -1,29 +1,21 @@ package com.epmet.commons.tools.filter; -import ch.qos.logback.classic.Level; import ch.qos.logback.classic.filter.LevelFilter; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.StackTraceElementProxy; import ch.qos.logback.core.spi.FilterReply; -import com.epmet.commons.tools.constant.AppClientConstant; -import com.epmet.commons.tools.constant.ThreadLocalConstant; -import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.enums.EnvEnum; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DingdingMsgSender; import com.epmet.commons.tools.utils.SpringContextUtils; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.cloud.commons.util.InetUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; -import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,7 +39,7 @@ public class LogMsgSendFilter extends LevelFilter { @Override public FilterReply decide(ILoggingEvent event) { //如果日志级别等于设置的日志级别 则发送消息 - if (event.getLevel().isGreaterOrEqual(Level.ERROR)) { + /* if (event.getLevel().isGreaterOrEqual(Level.ERROR)) { try { getServerInfo(); if (EnvEnum.LOCAL.getName().equals(activeEnv)){ @@ -118,7 +110,7 @@ public class LogMsgSendFilter extends LevelFilter { } catch (Exception e) { logger.warn("decide exception", e); } - } + }*/ //交给其他filter继续向下处理 return super.decide(event);