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 2ffe50a5f4..f97e405ed0 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 @@ -28,6 +28,7 @@ public class LogMsgSendFilter extends LevelFilter { private String webHook; private String secret; private String activeEnv; + private String appName; @Override public FilterReply decide(ILoggingEvent event) { @@ -41,6 +42,10 @@ public class LogMsgSendFilter extends LevelFilter { stringBuilder.append("告警级别:" + event.getLevel()); stringBuilder.append("\n"); + if (StringUtils.isNotBlank(appName)) { + stringBuilder.append("服务名称:" + appName); + stringBuilder.append("\n"); + } if (StringUtils.isNotBlank(activeEnv)) { stringBuilder.append("告警环境:" + EnvEnum.getEnum(activeEnv).getName()); stringBuilder.append("\n"); @@ -122,6 +127,10 @@ public class LogMsgSendFilter extends LevelFilter { this.activeEnv = activeEnv; } + public void setAppName(String appName) { + this.appName = appName; + } + public void setWebHook(String webHook) { this.webHook = webHook; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml index 3d93d8a331..9a76a9c74f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml @@ -136,6 +136,7 @@ ${activeEnv} ${webHook} ${secret} + ${appname} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java new file mode 100644 index 0000000000..ccb3d23d6a --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.controller; + +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 定时任务 + * + * @author Mark sunlightcs@gmail.com + */ +@Slf4j +@RestController +@RequestMapping("demo") +@Api(tags="定时任务") +public class DemoController { + @GetMapping("testAlarm") + public void testAlarm() { + //for (int i = 0; i < 20; i++) { + log.error("测试消息"); + //} + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-job/epmet-job-server/src/main/resources/logback-spring.xml index 9f63b9901f..fcfb1de19e 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-job/epmet-job-server/src/main/resources/logback-spring.xml @@ -135,6 +135,7 @@ ${activeEnv} ${webHook} ${secret} + ${appname}