|
|
@ -1,21 +1,29 @@ |
|
|
|
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; |
|
|
|
|
|
|
@ -39,7 +47,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 { |
|
|
|
//排除其他包路径的东西
|
|
|
|
if (!event.getLoggerName().startsWith(baseProjectPackage)){ |
|
|
@ -114,7 +122,7 @@ public class LogMsgSendFilter extends LevelFilter { |
|
|
|
} catch (Exception e) { |
|
|
|
logger.warn("decide exception", e); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
//交给其他filter继续向下处理
|
|
|
|
return super.decide(event); |
|
|
|
|
|
|
|