yangzhijie пре 6 година
родитељ
комит
1551795cc2
2 измењених фајлова са 264 додато и 253 уклоњено
  1. 219 209
      pom.xml
  2. 45 44
      src/main/resources/log4j2.xml

+ 219 - 209
pom.xml

@@ -1,210 +1,220 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>com.leanwo.gateway</groupId>
-	<artifactId>GatewayServer</artifactId>
-	<version>0.0.1</version>
-
-	<!--指定父级依赖 -->
-	<parent>
-		<groupId>org.springframework.boot</groupId>
-		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.2.4.RELEASE</version>
-		<relativePath /> <!-- lookup parent from repository -->
-	</parent>
-
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<h2.version>2.5.0-b60</h2.version>
-		<java.version>1.8</java.version>
-		<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
-	</properties>
-
-	<dependencies>
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter</artifactId>
-			<exclusions>
-				<exclusion>
-					<groupId>org.springframework.boot</groupId>
-					<artifactId>spring-boot-starter-logging</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-log4j2</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework.cloud</groupId>
-			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework.cloud</groupId>
-			<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-test</artifactId>
-			<scope>test</scope>
-		</dependency>
-
-	</dependencies>
-
-
-	<dependencyManagement>
-		<dependencies>
-			<dependency>
-				<groupId>org.springframework.cloud</groupId>
-				<artifactId>spring-cloud-dependencies</artifactId>
-				<version>${spring-cloud.version}</version>
-				<type>pom</type>
-				<scope>import</scope>
-			</dependency>
-		</dependencies>
-	</dependencyManagement>
-
-
-	<build>
-		<!-- jar包名 -->
-		<finalName>GatewayServer</finalName>
-		<!--默认源代码目录 -->
-		<sourceDirectory>src/main/java </sourceDirectory>
-		<!--默认测试源代码目录 -->
-		<testSourceDirectory>src/test/java</testSourceDirectory>
-		<!--默认资源目录 -->
-		<resources>
-			<resource>
-				<directory>src/main/resources</directory>
-			</resource>
-		</resources>
-
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.8</source>
-					<target>1.8</target>
-					<skip>true</skip>
-				</configuration>
-			</plugin>
-
-			<plugin>
-				<groupId>org.springframework.boot</groupId>
-				<artifactId>spring-boot-maven-plugin</artifactId>
-			</plugin>
-
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<configuration>
-					<skip>true</skip>
-				</configuration>
-			</plugin>
-
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-jar-plugin</artifactId>
-				<configuration>
-					<!-- 指定打包的jar包输出路径 -->
-					<outputDirectory>${project.build.directory}/${project.version}</outputDirectory>
-					<!--不打入jar包的文件类型或者路径 -->
-					<excludes>
-						<!-- <exclude>**/*.properties</exclude> -->
-						<!-- <exclude>**/*.xml</exclude> -->
-						<!-- <exclude>**/*.yml</exclude> -->
-						<!-- <exclude>static/**</exclude> -->
-						<!-- <exclude>templates/**</exclude> -->
-					</excludes>
-					<archive>
-						<!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
-						<manifestEntries>
-							<Class-Path>resources/</Class-Path>
-						</manifestEntries>
-						<manifest>
-							<addClasspath>true</addClasspath>
-							<classpathPrefix>lib/</classpathPrefix>
-							<mainClass>com.leanwo.gateway.GatewayApp</mainClass>
-						</manifest>
-					</archive>
-				</configuration>
-			</plugin>
-
-			<!-- 分离lib -->
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>copy-dependencies</id>
-						<phase>package</phase>
-						<goals>
-							<goal>copy-dependencies</goal>
-						</goals>
-						<configuration>
-							<!-- 依赖包输出目录 -->
-							<outputDirectory>${project.build.directory}/${project.version}/lib</outputDirectory>
-							<excludeTransitive>false</excludeTransitive>
-							<stripVersion>false</stripVersion>
-							<!-- 依赖包的作用域 -->
-							<includeScope>runtime</includeScope>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-
-			<!-- 复制资源文件 -->
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-resources-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>copy-dependencies</id>
-						<phase>package</phase>
-						<goals>
-							<goal>copy-resources</goal>
-						</goals>
-						<configuration>
-							<!-- 资源文件输出目录 -->
-							<outputDirectory>${project.build.directory}/${project.version}/resources</outputDirectory>
-							<resources>
-								<resource>
-									<directory>src/main/resources</directory>
-									<excludes>
-										<exclude>*.bat</exclude>
-									</excludes>
-								</resource>
-							</resources>
-						</configuration>
-					</execution>
-
-					<execution>
-						<id>copy-dependencies-bat</id>
-						<phase>package</phase>
-						<goals>
-							<goal>copy-resources</goal>
-						</goals>
-						<configuration>
-							<!-- 资源文件输出目录 -->
-							<outputDirectory>${project.build.directory}/${project.version}</outputDirectory>
-							<resources>
-								<resource>
-									<directory>src/main/resources</directory>
-									<includes>
-										<include>*.bat</include>
-									</includes>
-								</resource>
-							</resources>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.leanwo.gateway</groupId>
+	<artifactId>GatewayServer</artifactId>
+	<version>0.0.1</version>
+
+	<!--指定父级依赖 -->
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.2.4.RELEASE</version>
+		<relativePath /> <!-- lookup parent from repository -->
+	</parent>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<h2.version>2.5.0-b60</h2.version>
+		<java.version>1.8</java.version>
+		<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>org.springframework.boot</groupId>
+					<artifactId>spring-boot-starter-logging</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-log4j2</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.cloud</groupId>
+			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.cloud</groupId>
+			<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+
+	</dependencies>
+
+
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.springframework.cloud</groupId>
+				<artifactId>spring-cloud-dependencies</artifactId>
+				<version>${spring-cloud.version}</version>
+				<type>pom</type>
+				<scope>import</scope>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+
+
+	<build>
+		<!-- jar包名 -->
+		<finalName>GatewayServer</finalName>
+		<!--默认源代码目录 -->
+		<sourceDirectory>src/main/java </sourceDirectory>
+		<!--默认测试源代码目录 -->
+		<testSourceDirectory>src/test/java</testSourceDirectory>
+		<!--默认资源目录 -->
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+			</resource>
+		</resources>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.8</source>
+					<target>1.8</target>
+					<skip>true</skip>
+				</configuration>
+			</plugin>
+
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<skip>true</skip>
+				</configuration>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<configuration>
+					<!-- 指定打包的jar包输出路径 -->
+					<outputDirectory>${project.build.directory}/${project.version}</outputDirectory>
+					<!--不打入jar包的文件类型或者路径 -->
+					<excludes>
+						<!-- <exclude>**/*.properties</exclude> -->
+						<!-- <exclude>**/*.xml</exclude> -->
+						<!-- <exclude>**/*.yml</exclude> -->
+						<!-- <exclude>static/**</exclude> -->
+						<!-- <exclude>templates/**</exclude> -->
+					</excludes>
+					<archive>
+						<!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
+						<manifestEntries>
+							<Class-Path>resources/</Class-Path>
+						</manifestEntries>
+						<manifest>
+							<addClasspath>true</addClasspath>
+							<classpathPrefix>lib/</classpathPrefix>
+							<mainClass>com.leanwo.gateway.GatewayApp</mainClass>
+						</manifest>
+					</archive>					
+					<!--注意这玩意从编译结果目录开始算目录结构-->
+					<excludes>				         
+				         <exclude>**/*.yml</exclude>
+				         <exclude>**/*.xml</exclude>
+				         <exclude>**/*.bat</exclude>
+				         <exclude>**/*.properties</exclude>
+				         <exclude>**/*.sql</exclude>
+				         <exclude>**/*.txt</exclude>
+				         <exclude>**/*.jks</exclude>
+				     </excludes>
+				</configuration>
+			</plugin>
+
+			<!-- 分离lib -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>copy-dependencies</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<!-- 依赖包输出目录 -->
+							<outputDirectory>${project.build.directory}/${project.version}/lib</outputDirectory>
+							<excludeTransitive>false</excludeTransitive>
+							<stripVersion>false</stripVersion>
+							<!-- 依赖包的作用域 -->
+							<includeScope>runtime</includeScope>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+
+			<!-- 复制资源文件 -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-resources-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>copy-dependencies</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<!-- 资源文件输出目录 -->
+							<outputDirectory>${project.build.directory}/${project.version}/resources</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/main/resources</directory>
+									<excludes>
+										<exclude>*.bat</exclude>
+									</excludes>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+
+					<execution>
+						<id>copy-dependencies-bat</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<!-- 资源文件输出目录 -->
+							<outputDirectory>${project.build.directory}/${project.version}</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/main/resources</directory>
+									<includes>
+										<include>*.bat</include>
+									</includes>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 </project>

+ 45 - 44
src/main/resources/log4j2.xml

@@ -1,45 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration status="WARN" monitorInterval="30">
-
-    <Properties>
-        <Property name="LOG_HOME">logs/</Property>
-    </Properties>
-    
-	<!-- 先定义所有的appender -->
-	<appenders>
-		<Console name="Console" target="SYSTEM_OUT">
-            <!-- 控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
-            <ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
-            <!-- 这个都知道是输出日志的格式 -->
-            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} [%L] [%M] - %msg%xEx%n"/>
-        </Console>
-        
-		<!-- 这个会打印出所有的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档 -->
-		<RollingFile name="RollingFile"
-			fileName="${LOG_HOME}/server-management.log"
-			filePattern="${LOG_HOME}/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
-			<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" />
-			<PatternLayout
-				pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} [%L] [%M] - %msg%xEx%n" />
-			<SizeBasedTriggeringPolicy size="2MB" />
-		</RollingFile>
-	</appenders>
-	<!-- 然后定义logger,只有定义了logger并引入的appender,appender才会生效 -->
-	<loggers>
-		<!-- 建立一个默认的root的logger -->
-		<root level="debug">
-			<appender-ref ref="RollingFile" />
-			<appender-ref ref="Console" />
-		</root>
-		
-        <!-- 第三方日志系统 -->
-        <logger name="org.springframework" level="error"/>
-        <logger name="org.hibernate" level="error"/>
-        <logger name="com.mchange.v2" level="error"/>
-        <logger name="com.alibaba.druid" level="error"/>
-        <logger name="org.eclipse.jetty" level="error"/>
-        <logger name="net.sf.ehcache" level="error"/>
-        <logger name="org.apache.http" level="error"/>
-        <logger name="com.netflix.discovery" level="error"/>
-	</loggers>
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="WARN" monitorInterval="30">
+
+    <Properties>
+        <Property name="LOG_HOME">logs/</Property>
+    </Properties>
+    
+	<!-- 先定义所有的appender -->
+	<appenders>
+		<Console name="Console" target="SYSTEM_OUT">
+            <!-- 控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
+            <ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
+            <!-- 这个都知道是输出日志的格式 -->
+            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} [%L] [%M] - %msg%xEx%n"/>
+        </Console>
+        
+		<!-- 这个会打印出所有的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档 -->
+		<RollingFile name="RollingFile"
+			fileName="${LOG_HOME}/server-management.log"
+			filePattern="${LOG_HOME}/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
+			<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" />
+			<PatternLayout
+				pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} [%L] [%M] - %msg%xEx%n" />
+			<SizeBasedTriggeringPolicy size="2MB" />
+		</RollingFile>
+	</appenders>
+	<!-- 然后定义logger,只有定义了logger并引入的appender,appender才会生效 -->
+	<loggers>
+		<!-- 建立一个默认的root的logger -->
+		<root level="debug">
+			<appender-ref ref="RollingFile" />
+			<appender-ref ref="Console" />
+		</root>
+		
+        <!-- 第三方日志系统 -->
+        <logger name="org.springframework" level="error"/>
+        <logger name="org.hibernate" level="error"/>
+        <logger name="com.mchange.v2" level="error"/>
+        <logger name="com.alibaba.druid" level="error"/>
+        <logger name="org.eclipse.jetty" level="error"/>
+        <logger name="net.sf.ehcache" level="error"/>
+        <logger name="org.apache.http" level="error"/>
+        <logger name="com.netflix.discovery" level="error"/>
+        <logger name="com.netflix.config" level="error"/>
+	</loggers>
 </configuration>