Showing
14 changed files
with
747 additions
and
0 deletions
.gitignore
0 → 100644
monitor-ui-ctrl/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <parent> | ||
6 | + <artifactId>monitor-ui</artifactId> | ||
7 | + <groupId>monitor-ui</groupId> | ||
8 | + <version>1.0-SNAPSHOT</version> | ||
9 | + </parent> | ||
10 | + <modelVersion>4.0.0</modelVersion> | ||
11 | + | ||
12 | + <artifactId>monitor-ui-ctrl</artifactId> | ||
13 | + <version>1.0-SNAPSHOT</version> | ||
14 | + | ||
15 | + <dependencies> | ||
16 | + <dependency> | ||
17 | + <groupId>monitor-ui</groupId> | ||
18 | + <artifactId>monitor-ui-service</artifactId> | ||
19 | + </dependency> | ||
20 | + <dependency> | ||
21 | + <groupId>org.springframework</groupId> | ||
22 | + <artifactId>spring-webmvc</artifactId> | ||
23 | + </dependency> | ||
24 | + <dependency> | ||
25 | + <groupId>org.springframework</groupId> | ||
26 | + <artifactId>spring-web</artifactId> | ||
27 | + </dependency> | ||
28 | + <dependency> | ||
29 | + <groupId>org.springframework</groupId> | ||
30 | + <artifactId>spring-oxm</artifactId> | ||
31 | + </dependency> | ||
32 | + <dependency> | ||
33 | + <groupId>org.springframework</groupId> | ||
34 | + <artifactId>spring-core</artifactId> | ||
35 | + </dependency> | ||
36 | + <dependency> | ||
37 | + <groupId>org.springframework</groupId> | ||
38 | + <artifactId>spring-aop</artifactId> | ||
39 | + </dependency> | ||
40 | + <dependency> | ||
41 | + <groupId>org.springframework</groupId> | ||
42 | + <artifactId>spring-context-support</artifactId> | ||
43 | + </dependency> | ||
44 | + <dependency> | ||
45 | + <groupId>org.springframework</groupId> | ||
46 | + <artifactId>spring-jdbc</artifactId> | ||
47 | + </dependency> | ||
48 | + <dependency> | ||
49 | + <groupId>org.aspectj</groupId> | ||
50 | + <artifactId>aspectjweaver</artifactId> | ||
51 | + </dependency> | ||
52 | + <dependency> | ||
53 | + <groupId>org.slf4j</groupId> | ||
54 | + <artifactId>slf4j-api</artifactId> | ||
55 | + </dependency> | ||
56 | + <dependency> | ||
57 | + <groupId>ch.qos.logback</groupId> | ||
58 | + <artifactId>logback-classic</artifactId> | ||
59 | + <scope>runtime</scope> | ||
60 | + </dependency> | ||
61 | + <dependency> | ||
62 | + <groupId>commons-lang</groupId> | ||
63 | + <artifactId>commons-lang</artifactId> | ||
64 | + <version>2.6</version> | ||
65 | + </dependency> | ||
66 | + <dependency> | ||
67 | + <groupId>com.alibaba</groupId> | ||
68 | + <artifactId>fastjson</artifactId> | ||
69 | + <version>1.2.7</version> | ||
70 | + </dependency> | ||
71 | + <dependency> | ||
72 | + <groupId>junit</groupId> | ||
73 | + <artifactId>junit</artifactId> | ||
74 | + <version>3.8.1</version> | ||
75 | + <scope>test</scope> | ||
76 | + </dependency> | ||
77 | + </dependencies> | ||
78 | +</project> |
1 | +package com.ui.ctrl.test; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | + | ||
5 | +/** | ||
6 | + * | ||
7 | + * mysql order_info_check | ||
8 | + * Created by zhengyouwei on 2016/6/7. | ||
9 | + */ | ||
10 | +public class OrderInfoCheck implements Serializable{ | ||
11 | + | ||
12 | + private int id; | ||
13 | + private String event; | ||
14 | + private String context; | ||
15 | + private String ip; | ||
16 | + private String orderCode; | ||
17 | + private String response; | ||
18 | + private String isSend; | ||
19 | + private String body; | ||
20 | + private String influxdb; | ||
21 | + private String influxTime; | ||
22 | + private String createTime; | ||
23 | + private String updateTime; | ||
24 | + | ||
25 | + public int getId() { | ||
26 | + return id; | ||
27 | + } | ||
28 | + | ||
29 | + public void setId(int id) { | ||
30 | + this.id = id; | ||
31 | + } | ||
32 | + | ||
33 | + public String getEvent() { | ||
34 | + return event; | ||
35 | + } | ||
36 | + | ||
37 | + public void setEvent(String event) { | ||
38 | + this.event = event; | ||
39 | + } | ||
40 | + | ||
41 | + public String getContext() { | ||
42 | + return context; | ||
43 | + } | ||
44 | + | ||
45 | + public void setContext(String context) { | ||
46 | + this.context = context; | ||
47 | + } | ||
48 | + | ||
49 | + public String getIp() { | ||
50 | + return ip; | ||
51 | + } | ||
52 | + | ||
53 | + public void setIp(String ip) { | ||
54 | + this.ip = ip; | ||
55 | + } | ||
56 | + | ||
57 | + public String getOrderCode() { | ||
58 | + return orderCode; | ||
59 | + } | ||
60 | + | ||
61 | + public void setOrderCode(String orderCode) { | ||
62 | + this.orderCode = orderCode; | ||
63 | + } | ||
64 | + | ||
65 | + public String getResponse() { | ||
66 | + return response; | ||
67 | + } | ||
68 | + | ||
69 | + public void setResponse(String response) { | ||
70 | + this.response = response; | ||
71 | + } | ||
72 | + | ||
73 | + public String getIsSend() { | ||
74 | + return isSend; | ||
75 | + } | ||
76 | + | ||
77 | + public void setIsSend(String isSend) { | ||
78 | + this.isSend = isSend; | ||
79 | + } | ||
80 | + | ||
81 | + public String getBody() { | ||
82 | + return body; | ||
83 | + } | ||
84 | + | ||
85 | + public void setBody(String body) { | ||
86 | + this.body = body; | ||
87 | + } | ||
88 | + | ||
89 | + public String getInfluxdb() { | ||
90 | + return influxdb; | ||
91 | + } | ||
92 | + | ||
93 | + public void setInfluxdb(String influxdb) { | ||
94 | + this.influxdb = influxdb; | ||
95 | + } | ||
96 | + | ||
97 | + public String getInfluxTime() { | ||
98 | + return influxTime; | ||
99 | + } | ||
100 | + | ||
101 | + public void setInfluxTime(String influxTime) { | ||
102 | + this.influxTime = influxTime; | ||
103 | + } | ||
104 | + | ||
105 | + public String getCreateTime() { | ||
106 | + return createTime; | ||
107 | + } | ||
108 | + | ||
109 | + public void setCreateTime(String createTime) { | ||
110 | + this.createTime = createTime; | ||
111 | + } | ||
112 | + | ||
113 | + public String getUpdateTime() { | ||
114 | + return updateTime; | ||
115 | + } | ||
116 | + | ||
117 | + public void setUpdateTime(String updateTime) { | ||
118 | + this.updateTime = updateTime; | ||
119 | + } | ||
120 | +} |
1 | +package com.ui.ctrl.test; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.ui.service.HttpRestClientService; | ||
5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
6 | +import org.springframework.stereotype.Controller; | ||
7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
8 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
9 | + | ||
10 | +import java.util.HashMap; | ||
11 | +import java.util.Map; | ||
12 | + | ||
13 | +/** | ||
14 | + * Created by zhengyouwei on 2016/6/14. | ||
15 | + */ | ||
16 | +@Controller | ||
17 | +@RequestMapping("/test") | ||
18 | +public class TestCtrl { | ||
19 | + | ||
20 | + @Autowired | ||
21 | + private HttpRestClientService httpRestClientService; | ||
22 | + | ||
23 | + @RequestMapping("test") | ||
24 | + @ResponseBody | ||
25 | + public OrderInfoCheck test(){ | ||
26 | + Map map = new HashMap(); | ||
27 | + map.put("id",1); | ||
28 | + OrderInfoCheck result = httpRestClientService.postForObject("http://localhost:8081/monitor/test/get",map,OrderInfoCheck.class); | ||
29 | + return result; | ||
30 | + } | ||
31 | +} |
monitor-ui-service/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <parent> | ||
6 | + <artifactId>monitor-ui</artifactId> | ||
7 | + <groupId>monitor-ui</groupId> | ||
8 | + <version>1.0-SNAPSHOT</version> | ||
9 | + </parent> | ||
10 | + <modelVersion>4.0.0</modelVersion> | ||
11 | + | ||
12 | + <artifactId>monitor-ui-service</artifactId> | ||
13 | + <version>1.0-SNAPSHOT</version> | ||
14 | + <dependencies> | ||
15 | + | ||
16 | + <!-- 需要的Spring Framework jar包 --> | ||
17 | + <dependency> | ||
18 | + <groupId>org.springframework</groupId> | ||
19 | + <artifactId>spring-webmvc</artifactId> | ||
20 | + </dependency> | ||
21 | + <dependency> | ||
22 | + <groupId>org.springframework</groupId> | ||
23 | + <artifactId>spring-context</artifactId> | ||
24 | + </dependency> | ||
25 | + <dependency> | ||
26 | + <groupId>org.springframework</groupId> | ||
27 | + <artifactId>spring-web</artifactId> | ||
28 | + </dependency> | ||
29 | + <dependency> | ||
30 | + <groupId>org.springframework</groupId> | ||
31 | + <artifactId>spring-aop</artifactId> | ||
32 | + </dependency> | ||
33 | + <dependency> | ||
34 | + <groupId>com.netflix.archaius</groupId> | ||
35 | + <artifactId>archaius-core</artifactId> | ||
36 | + </dependency> | ||
37 | + <dependency> | ||
38 | + <groupId>org.aspectj</groupId> | ||
39 | + <artifactId>aspectjweaver</artifactId> | ||
40 | + </dependency> | ||
41 | + <dependency> | ||
42 | + <groupId>javax.servlet</groupId> | ||
43 | + <artifactId>servlet-api</artifactId> | ||
44 | + </dependency> | ||
45 | + <dependency> | ||
46 | + <groupId>org.apache.httpcomponents</groupId> | ||
47 | + <artifactId>httpclient</artifactId> | ||
48 | + </dependency> | ||
49 | + <dependency> | ||
50 | + <groupId>org.slf4j</groupId> | ||
51 | + <artifactId>jcl-over-slf4j</artifactId> | ||
52 | + </dependency> | ||
53 | + <dependency> | ||
54 | + <groupId>ch.qos.logback</groupId> | ||
55 | + <artifactId>logback-classic</artifactId> | ||
56 | + </dependency> | ||
57 | + <dependency> | ||
58 | + <groupId>com.alibaba</groupId> | ||
59 | + <artifactId>fastjson</artifactId> | ||
60 | + <version>1.2.7</version> | ||
61 | + </dependency> | ||
62 | + <dependency> | ||
63 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
64 | + <artifactId>jackson-core</artifactId> | ||
65 | + </dependency> | ||
66 | + <dependency> | ||
67 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
68 | + <artifactId>jackson-databind</artifactId> | ||
69 | + </dependency> | ||
70 | + | ||
71 | + </dependencies> | ||
72 | + | ||
73 | +</project> |
1 | +package com.ui.service.impl; | ||
2 | + | ||
3 | +import com.ui.service.HttpRestClientService; | ||
4 | +import org.slf4j.Logger; | ||
5 | +import org.slf4j.LoggerFactory; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | +import org.springframework.web.client.RestTemplate; | ||
9 | + | ||
10 | +import java.util.Map; | ||
11 | + | ||
12 | +@Service("httpRestClientService") | ||
13 | +public class HttpRestClientServiceImpl implements HttpRestClientService { | ||
14 | + | ||
15 | + private static final Logger logger = LoggerFactory | ||
16 | + .getLogger(HttpRestClientServiceImpl.class); | ||
17 | + | ||
18 | + @Autowired | ||
19 | + private RestTemplate restTemplate; | ||
20 | + | ||
21 | + @Override | ||
22 | + public <T> T postForObject(String url, Object request, Class<T> responseType) { | ||
23 | + try { | ||
24 | + return restTemplate.postForObject(url, request,responseType); | ||
25 | + } catch (Exception e) { | ||
26 | + logger.error("postForObject failed!url:"+url, e); | ||
27 | + return null; | ||
28 | + } | ||
29 | + } | ||
30 | + | ||
31 | +} |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"> | ||
6 | + | ||
7 | + <bean id="pollingConnectionManager" class="org.apache.http.impl.conn.PoolingHttpClientConnectionManager"> | ||
8 | + <property name="maxTotal" value="20" /> | ||
9 | + <property name="defaultMaxPerRoute" value="5" /> | ||
10 | + </bean> | ||
11 | + | ||
12 | + <bean id="httpClientBuilder" class="org.apache.http.impl.client.HttpClientBuilder" | ||
13 | + factory-method="create"> | ||
14 | + <property name="connectionManager" ref="pollingConnectionManager" /> | ||
15 | + </bean> | ||
16 | + | ||
17 | + <bean id="httpClient" factory-bean="httpClientBuilder" | ||
18 | + factory-method="build" /> | ||
19 | + | ||
20 | + <!-- --> | ||
21 | + <bean id="clientHttpRequestFactory" | ||
22 | + class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory"> | ||
23 | + <constructor-arg ref="httpClient" /> | ||
24 | + <property name="connectTimeout" value="30000" /> | ||
25 | + <property name="readTimeout" value="30000" /> | ||
26 | + </bean> | ||
27 | + | ||
28 | + <bean id="restTemplate" class="org.springframework.web.client.RestTemplate"> | ||
29 | + <constructor-arg ref="clientHttpRequestFactory" /> | ||
30 | + <property name="messageConverters"> | ||
31 | + <list> | ||
32 | + <bean class="org.springframework.http.converter.StringHttpMessageConverter" /> | ||
33 | + <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter" /> | ||
34 | + <bean class="org.springframework.http.converter.FormHttpMessageConverter" /> | ||
35 | + <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" /> | ||
36 | + <bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter" /> | ||
37 | + </list> | ||
38 | + </property> | ||
39 | + </bean> | ||
40 | + | ||
41 | + | ||
42 | +</beans> |
monitor-ui-web/pom.xml
0 → 100644
1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
3 | + <parent> | ||
4 | + <artifactId>monitor-ui</artifactId> | ||
5 | + <groupId>monitor-ui</groupId> | ||
6 | + <version>1.0-SNAPSHOT</version> | ||
7 | + </parent> | ||
8 | + <modelVersion>4.0.0</modelVersion> | ||
9 | + <artifactId>monitor-ui-web</artifactId> | ||
10 | + <packaging>war</packaging> | ||
11 | + <version>1.0-SNAPSHOT</version> | ||
12 | + <name>monitor-ui-web Maven Webapp</name> | ||
13 | + <url>http://maven.apache.org</url> | ||
14 | + | ||
15 | + <dependencies> | ||
16 | + <dependency> | ||
17 | + <groupId>org.springframework</groupId> | ||
18 | + <artifactId>spring-webmvc</artifactId> | ||
19 | + </dependency> | ||
20 | + <dependency> | ||
21 | + <groupId>org.springframework</groupId> | ||
22 | + <artifactId>spring-web</artifactId> | ||
23 | + </dependency> | ||
24 | + <dependency> | ||
25 | + <groupId>org.springframework</groupId> | ||
26 | + <artifactId>spring-oxm</artifactId> | ||
27 | + </dependency> | ||
28 | + <dependency> | ||
29 | + <groupId>org.springframework</groupId> | ||
30 | + <artifactId>spring-core</artifactId> | ||
31 | + </dependency> | ||
32 | + <dependency> | ||
33 | + <groupId>org.springframework</groupId> | ||
34 | + <artifactId>spring-aop</artifactId> | ||
35 | + </dependency> | ||
36 | + <dependency> | ||
37 | + <groupId>org.springframework</groupId> | ||
38 | + <artifactId>spring-context-support</artifactId> | ||
39 | + </dependency> | ||
40 | + <dependency> | ||
41 | + <groupId>org.springframework</groupId> | ||
42 | + <artifactId>spring-jdbc</artifactId> | ||
43 | + </dependency> | ||
44 | + <dependency> | ||
45 | + <groupId>org.aspectj</groupId> | ||
46 | + <artifactId>aspectjweaver</artifactId> | ||
47 | + </dependency> | ||
48 | + <dependency> | ||
49 | + <groupId>org.slf4j</groupId> | ||
50 | + <artifactId>slf4j-api</artifactId> | ||
51 | + </dependency> | ||
52 | + <dependency> | ||
53 | + <groupId>ch.qos.logback</groupId> | ||
54 | + <artifactId>logback-classic</artifactId> | ||
55 | + <scope>runtime</scope> | ||
56 | + </dependency> | ||
57 | + <dependency> | ||
58 | + <groupId>commons-lang</groupId> | ||
59 | + <artifactId>commons-lang</artifactId> | ||
60 | + <version>2.6</version> | ||
61 | + </dependency> | ||
62 | + <dependency> | ||
63 | + <groupId>org.apache.httpcomponents</groupId> | ||
64 | + <artifactId>httpclient</artifactId> | ||
65 | + </dependency> | ||
66 | + <dependency> | ||
67 | + <groupId>com.alibaba</groupId> | ||
68 | + <artifactId>fastjson</artifactId> | ||
69 | + <version>1.2.7</version> | ||
70 | + </dependency> | ||
71 | + <dependency> | ||
72 | + <groupId>javax.servlet</groupId> | ||
73 | + <artifactId>servlet-api</artifactId> | ||
74 | + </dependency> | ||
75 | + <dependency> | ||
76 | + <groupId>javax.servlet.jsp</groupId> | ||
77 | + <artifactId>jsp-api</artifactId> | ||
78 | + </dependency> | ||
79 | + <dependency> | ||
80 | + <groupId>javax.servlet</groupId> | ||
81 | + <artifactId>jstl</artifactId> | ||
82 | + </dependency> | ||
83 | + <dependency> | ||
84 | + <groupId>monitor-ui</groupId> | ||
85 | + <artifactId>monitor-ui-ctrl</artifactId> | ||
86 | + </dependency> | ||
87 | + <dependency> | ||
88 | + <groupId>junit</groupId> | ||
89 | + <artifactId>junit</artifactId> | ||
90 | + <version>3.8.1</version> | ||
91 | + <scope>test</scope> | ||
92 | + </dependency> | ||
93 | + </dependencies> | ||
94 | + | ||
95 | + <build> | ||
96 | + <finalName>monitor-ui</finalName> | ||
97 | + <plugins> | ||
98 | + <plugin> | ||
99 | + <groupId>org.apache.maven.plugins</groupId> | ||
100 | + <artifactId>maven-war-plugin</artifactId> | ||
101 | + <configuration> | ||
102 | + <warName>ROOT</warName> | ||
103 | + </configuration> | ||
104 | + </plugin> | ||
105 | + </plugins> | ||
106 | + </build> | ||
107 | +</project> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:context="http://www.springframework.org/schema/context" | ||
4 | + xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
5 | + xmlns:aop="http://www.springframework.org/schema/aop" | ||
6 | + xmlns="http://www.springframework.org/schema/beans" | ||
7 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
8 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
9 | + http://www.springframework.org/schema/context | ||
10 | + http://www.springframework.org/schema/context/spring-context.xsd | ||
11 | + http://www.springframework.org/schema/aop | ||
12 | + http://www.springframework.org/schema/aop/spring-aop-3.1.xsd | ||
13 | + http://www.springframework.org/schema/mvc | ||
14 | + http://www.springframework.org/schema/mvc/spring-mvc.xsd"> | ||
15 | + | ||
16 | + <context:property-placeholder location="classpath:*.properties" /> | ||
17 | + <context:component-scan base-package="com.ui" /> | ||
18 | + <!-- 打开aop 注解 --> | ||
19 | + <aop:aspectj-autoproxy proxy-target-class="true"/> | ||
20 | + | ||
21 | + <mvc:annotation-driven> | ||
22 | + <mvc:message-converters> | ||
23 | + <ref bean="stringConverter" /> | ||
24 | + <ref bean="jsonConverter" /> | ||
25 | + </mvc:message-converters> | ||
26 | + </mvc:annotation-driven> | ||
27 | + | ||
28 | + <!--字符串转换器 --> | ||
29 | + <bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter"> | ||
30 | + <property name="supportedMediaTypes"> | ||
31 | + <list> | ||
32 | + <value>text/plain;charset=UTF-8</value> | ||
33 | + <value>text/html;charset=UTF-8</value> | ||
34 | + </list> | ||
35 | + </property> | ||
36 | + </bean> | ||
37 | + | ||
38 | + <!-- json转换器 application/json --> | ||
39 | + <bean id="jsonConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> | ||
40 | + </bean> | ||
41 | + | ||
42 | + <bean | ||
43 | + class="org.springframework.web.servlet.view.InternalResourceViewResolver"> | ||
44 | + <property name="prefix"> | ||
45 | + <value>/views/</value> | ||
46 | + </property> | ||
47 | + <property name="suffix"> | ||
48 | + <value>.jsp</value> | ||
49 | + </property> | ||
50 | + </bean> | ||
51 | + | ||
52 | +</beans> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | + | ||
3 | +<!-- 从高到地低 OFF 、 FATAL 、 ERROR 、 WARN 、 INFO 、 DEBUG 、 TRACE 、 ALL --> | ||
4 | +<!-- 日志输出规则 根据当前ROOT 级别,日志输出时,级别高于root默认的级别时 会输出 --> | ||
5 | +<!-- 以下 每个配置的 filter 是过滤掉输出文件里面,会出现高级别文件,依然出现低级别的日志信息,通过filter 过滤只记录本级别的日志--> | ||
6 | + | ||
7 | + | ||
8 | +<!-- 属性描述 scan:性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 | ||
9 | + debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> | ||
10 | +<configuration scan="true" scanPeriod="60 seconds" debug="false"> | ||
11 | + <!-- 日志最大的历史 7天 --> | ||
12 | + <property name="maxHistory" value="7"/> | ||
13 | + <!-- 日志最大的文件大小 10MB--> | ||
14 | + <property name="maxFileSize" value="10MB"/> | ||
15 | + | ||
16 | + <!-- ConsoleAppender 控制台输出日志 --> | ||
17 | + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
18 | + <!-- 对日志进行格式化 --> | ||
19 | + <encoder> | ||
20 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern> | ||
21 | + </encoder> | ||
22 | + </appender> | ||
23 | + | ||
24 | + <!-- WARN级别日志 appender --> | ||
25 | + <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
26 | + <file>${catalina.home}/logs/warn-log</file> | ||
27 | + <!-- 过滤器,过滤掉 TRACE 和 DEBUG 和 INFO 级别的日志 --> | ||
28 | + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
29 | + <level>WARN</level> | ||
30 | + </filter> | ||
31 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
32 | + <!-- 按天回滚 daily --> | ||
33 | + <fileNamePattern>${catalina.home}/logs/%d{yyyy-MM-dd}/warn-log.log</fileNamePattern> | ||
34 | + <!-- 日志最大的保存天数 --> | ||
35 | + <maxHistory>${maxHistory}</maxHistory> | ||
36 | + </rollingPolicy> | ||
37 | + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> | ||
38 | + <maxFileSize>${maxFileSize}</maxFileSize> | ||
39 | + </triggeringPolicy> | ||
40 | + <encoder> | ||
41 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> | ||
42 | + </encoder> | ||
43 | + </appender> | ||
44 | + | ||
45 | + <!-- DEBUG级别日志 appender --> | ||
46 | + <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
47 | + <file>${catalina.home}/logs/debug-log</file> | ||
48 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
49 | + <!-- 按天回滚 daily --> | ||
50 | + <fileNamePattern>${catalina.home}/logs/%d{yyyy-MM-dd}/debug-log.log</fileNamePattern> | ||
51 | + <!-- 日志最大的历史 60天 --> | ||
52 | + <maxHistory>${maxHistory}</maxHistory> | ||
53 | + </rollingPolicy> | ||
54 | + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> | ||
55 | + <maxFileSize>${maxFileSize}</maxFileSize> | ||
56 | + </triggeringPolicy> | ||
57 | + <encoder> | ||
58 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> | ||
59 | + </encoder> | ||
60 | + </appender> | ||
61 | + | ||
62 | + <!-- root级别 DEBUG --> | ||
63 | + <root level="DEBUG"> | ||
64 | + <!-- 控制台输出 --> | ||
65 | + <appender-ref ref="STDOUT" /> | ||
66 | + <!-- 文件输出 --> | ||
67 | + <appender-ref ref="DEBUG" /> | ||
68 | + <appender-ref ref="WARN" /> | ||
69 | + </root> | ||
70 | + | ||
71 | +</configuration> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns="http://java.sun.com/xml/ns/javaee" | ||
4 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
5 | + id="schedule-console" version="3.0"> | ||
6 | + | ||
7 | + <!-- Only one context --> | ||
8 | + <context-param> | ||
9 | + <param-name>contextConfigLocation</param-name> | ||
10 | + <param-value>classpath*:META-INF/spring/spring*.xml</param-value> | ||
11 | + </context-param> | ||
12 | + <!--spring profile: restful client is local or zookeeper --> | ||
13 | + <context-param> | ||
14 | + <param-name>spring.profiles.active</param-name> | ||
15 | + <param-value>local,production</param-value> | ||
16 | + </context-param> | ||
17 | + <servlet> | ||
18 | + <servlet-name>dispatcher</servlet-name> | ||
19 | + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | ||
20 | + <init-param> | ||
21 | + <param-name>contextConfigLocation</param-name> | ||
22 | + <param-value></param-value> | ||
23 | + </init-param> | ||
24 | + <load-on-startup>1</load-on-startup> | ||
25 | + </servlet> | ||
26 | + <servlet-mapping> | ||
27 | + <servlet-name>dispatcher</servlet-name> | ||
28 | + <url-pattern>/</url-pattern> | ||
29 | + </servlet-mapping> | ||
30 | + <listener> | ||
31 | + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | ||
32 | + </listener> | ||
33 | + | ||
34 | + <!-- 编码过滤器 --> | ||
35 | + <filter> | ||
36 | + <filter-name>encodingFilter</filter-name> | ||
37 | + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | ||
38 | + <init-param> | ||
39 | + <param-name>encoding</param-name> | ||
40 | + <param-value>UTF-8</param-value> | ||
41 | + </init-param> | ||
42 | + </filter> | ||
43 | + <filter-mapping> | ||
44 | + <filter-name>encodingFilter</filter-name> | ||
45 | + <url-pattern>/*</url-pattern> | ||
46 | + </filter-mapping> | ||
47 | + | ||
48 | + <welcome-file-list> | ||
49 | + <welcome-file>/index.jsp</welcome-file> | ||
50 | + </welcome-file-list> | ||
51 | +</web-app> |
monitor-ui-web/src/main/webapp/index.jsp
0 → 100644
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <modelVersion>4.0.0</modelVersion> | ||
6 | + | ||
7 | + <parent> | ||
8 | + <groupId>com.yoho</groupId> | ||
9 | + <artifactId>parent</artifactId> | ||
10 | + <version>1.1.0-SNAPSHOT</version> | ||
11 | + </parent> | ||
12 | + | ||
13 | + <groupId>monitor-ui</groupId> | ||
14 | + <artifactId>monitor-ui</artifactId> | ||
15 | + <packaging>pom</packaging> | ||
16 | + <version>1.0-SNAPSHOT</version> | ||
17 | + | ||
18 | + <properties> | ||
19 | + <project-name>monitor-ui</project-name> | ||
20 | + <project-version>1.0-SNAPSHOT</project-version> | ||
21 | + <json-version>2.4</json-version> | ||
22 | + <db-influx-version>2.2</db-influx-version> | ||
23 | + <java-gitlab-api-version>1.2.5</java-gitlab-api-version> | ||
24 | + <org.yaml-version>1.9</org.yaml-version> | ||
25 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
26 | + </properties> | ||
27 | + | ||
28 | + <dependencyManagement> | ||
29 | + <dependencies> | ||
30 | + | ||
31 | + <dependency> | ||
32 | + <groupId>javax.servlet</groupId> | ||
33 | + <artifactId>servlet-api</artifactId> | ||
34 | + <version>2.5</version> | ||
35 | + <scope>provided</scope> | ||
36 | + </dependency> | ||
37 | + <dependency> | ||
38 | + <groupId>javax.servlet.jsp</groupId> | ||
39 | + <artifactId>jsp-api</artifactId> | ||
40 | + <version>2.1</version> | ||
41 | + <scope>provided</scope> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>javax.servlet</groupId> | ||
45 | + <artifactId>jstl</artifactId> | ||
46 | + <version>1.2</version> | ||
47 | + </dependency> | ||
48 | + <dependency> | ||
49 | + <groupId>monitor-ui</groupId> | ||
50 | + <artifactId>monitor-ui-web</artifactId> | ||
51 | + <version>${project-version}</version> | ||
52 | + </dependency> | ||
53 | + <dependency> | ||
54 | + <groupId>monitor-ui</groupId> | ||
55 | + <artifactId>monitor-ui-ctrl</artifactId> | ||
56 | + <version>${project-version}</version> | ||
57 | + </dependency> | ||
58 | + <dependency> | ||
59 | + <groupId>monitor-ui</groupId> | ||
60 | + <artifactId>monitor-ui-service</artifactId> | ||
61 | + <version>${project-version}</version> | ||
62 | + </dependency> | ||
63 | + </dependencies> | ||
64 | + </dependencyManagement> | ||
65 | + | ||
66 | + | ||
67 | + <modules> | ||
68 | + <module>monitor-ui-web</module> | ||
69 | + <module>monitor-ui-ctrl</module> | ||
70 | + <module>monitor-ui-service</module> | ||
71 | + </modules> | ||
72 | + | ||
73 | + | ||
74 | +</project> |
-
Please register or login to post a comment