记得上下班打卡 | git大法好,push需谨慎

Commit 75b8d4f3 authored by 张国柄's avatar 张国柄

配置zuul;

parent 7e633f3f
...@@ -17,6 +17,6 @@ management: ...@@ -17,6 +17,6 @@ management:
rabbitmq: rabbitmq:
enabled: false enabled: false
security: security:
enabled: false enabled: false
#common-service-end #common-service-end
...@@ -15,7 +15,7 @@ liquidnet: ...@@ -15,7 +15,7 @@ liquidnet:
username: liquidnet username: liquidnet
password: LiquidNet!@#4 password: LiquidNet!@#4
knife4j: knife4j:
disable: false disable: true
redis: redis:
host: 192.168.31.205 host: 192.168.31.205
port: 6379 port: 6379
......
...@@ -79,9 +79,10 @@ spring: ...@@ -79,9 +79,10 @@ spring:
transportMode: "NIO" transportMode: "NIO"
data: data:
mongodb: mongodb:
uri: mongodb://${liquidnet.mongodb.host}:${liquidnet.mongodb.port}/ln_adam_mdb # uri: mongodb://${liquidnet.mongodb.host}:${liquidnet.mongodb.port}/ln_adam_mdb
#本地测试证书 #本地测试证书
sslEnabled: false sslEnabled: false
database: ln_adam_mdb
trustStore: trustStore:
trustStorePassword: trustStorePassword:
# uri: mongodb://smartnet:a43ljKmK8oqdOO902P@smartnet-nonprod-docdb-docdb.cluster-cgjsqu7tuka2.ap-southeast-1.docdb.amazonaws.com:27017/liquidnet_mgdb?ssl=true&ssl_ca_certs=/Users/anjiabin/Downloads/rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false # uri: mongodb://smartnet:a43ljKmK8oqdOO902P@smartnet-nonprod-docdb-docdb.cluster-cgjsqu7tuka2.ap-southeast-1.docdb.amazonaws.com:27017/liquidnet_mgdb?ssl=true&ssl_ca_certs=/Users/anjiabin/Downloads/rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false
...@@ -8,7 +8,7 @@ server: ...@@ -8,7 +8,7 @@ server:
knife4j: knife4j:
production: ${liquidnet.knife4j.disable} production: ${liquidnet.knife4j.disable}
basic: basic:
enable: true enable: false
username: ${liquidnet.security.username} username: ${liquidnet.security.username}
password: ${liquidnet.security.password} password: ${liquidnet.security.password}
# ----------------------------------------------------------- # -----------------------------------------------------------
...@@ -70,8 +70,9 @@ spring: ...@@ -70,8 +70,9 @@ spring:
password: ${liquidnet.rabbitmq.password} password: ${liquidnet.rabbitmq.password}
data: data:
mongodb: mongodb:
uri: mongodb://${liquidnet.mongodb.host}:${liquidnet.mongodb.port}/${liquidnet.mongodb.gfsdatabasename} uri: mongodb://${liquidnet.mongodb.user}:${liquidnet.mongodb.pwd}@${liquidnet.mongodb.host}:${liquidnet.mongodb.port}/?authSource=admin
sslEnabled: false sslEnabled: false
database: ${spring.data.mongodb.database}
datasource: datasource:
name: ${liquidnet.mysql.database-name} name: ${liquidnet.mysql.database-name}
url: jdbc:mysql://${liquidnet.mysql.urlHostAndPort}/${liquidnet.mysql.database-name}?serverTimezone=UTC&characterEncoding=utf-8&useSSL=false url: jdbc:mysql://${liquidnet.mysql.urlHostAndPort}/${liquidnet.mysql.database-name}?serverTimezone=UTC&characterEncoding=utf-8&useSSL=false
......
...@@ -3,7 +3,7 @@ liquidnet: ...@@ -3,7 +3,7 @@ liquidnet:
updating: updating:
switch: false switch: false
info: info:
port: 9001 port: 9002
context: context:
# context: /service-kylin # context: /service-kylin
name: liquidnet-service-kylin name: liquidnet-service-kylin
......
...@@ -8,7 +8,7 @@ server: ...@@ -8,7 +8,7 @@ server:
knife4j: knife4j:
production: ${liquidnet.knife4j.disable} production: ${liquidnet.knife4j.disable}
basic: basic:
enable: true enable: false
username: ${liquidnet.security.username} username: ${liquidnet.security.username}
password: ${liquidnet.security.password} password: ${liquidnet.security.password}
# ----------------------------------------------------------- # -----------------------------------------------------------
......
liquidnet:
info:
port: 7003
# context: /support-zuul
name: liquidnet-support-zuul
logfile:
path: ./logs
name: support-zuul
liquidnet:
info:
port: 7003
# context: /support-zuul
name: liquidnet-support-zuul
logfile:
path: ./logs
name: support-zuul
\ No newline at end of file
liquidnet:
info:
port: 7003
# context: /support-zuul
name: liquidnet-support-zuul
logfile:
path: ./logs
name: support-zuul
server:
port: ${liquidnet.info.port}
tomcat:
uri-encoding: UTF-8
servlet:
context-path:
# context-path: ${liquidnet.info.context}
# server:
# tomcat:
# accept-count: 500
# max-threads: 500
# min-spare-threads: 100
# max-connections: 1000
# connection-timeout: 5000
# -----------------------------------------------------------
knife4j:
production: ${liquidnet.knife4j.disable}
basic:
enable: true
username: ${liquidnet.security.username}
password: ${liquidnet.security.password}
# -----------------------------------------------------------
logging:
file:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: 200MB
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
#以下是为指定包设置日志级别
com.netflix: info
# -----------------------------------------------------------
spring: spring:
application: application:
name: liquidnet-gateway-zuul name: ${liquidnet.info.name}
server: autoconfigure:
port: 8040 exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
server: profiles:
tomcat: include: common-service
accept-count: 500 # cloud:
max-threads: 500 # bus:
min-spare-threads: 100 # destination: springCloudBus.${liquidnet.info.name}.port${liquidnet.info.port}
max-connections: 1000 # trace:
connection-timeout: 5000 # enabled: true
# -----------------------------------------------------------
eureka: eureka:
client: # client:
healthcheck: # register-with-eureka: true
enabled: true # fetch-registry: true
serviceUrl: # serviceUrl:
defaultZone: ${liquidnet.eureka.serviceUrl} # defaultZone: http://${liquidnet.security.username}:${liquidnet.security.password}@${liquidnet.eureka.host}/eureka-server/eureka
instance: instance:
prefer-ip-address: true hostname: ${spring.cloud.client.ip-address}
instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}} lease-expiration-duration-in-seconds: 15 #服务过期时间配置,超过这个时间没有接收到心跳EurekaServer就会将这个实例剔除
lease-renewal-interval-in-seconds: 15 lease-renewal-interval-in-seconds: 5 #服务刷新时间配置,每隔这个时间会主动心跳一次
lease-expiration-duration-in-seconds: 30 prefer-ip-address: true
metadata-map: instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}}
zone: YGZX # eureka可以理解的元数据 # -----------------------------------------------------------
liquidnet: YGZX # 不会影响客户端行为
server:
eviction-interval-timer-in-ms: 30000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
ribbon:
ConnectTimeout: 3000
ReadTimeout: 60000
eureka:
enabled: true
zuul: zuul:
prefix: /
host: host:
max-per-route-connections: 1000 max-per-route-connections: 1000
max-total-connections: 2000 max-total-connections: 2000
routes: routes:
liquidnet-provider-sms: /sms/** liquidnet-service-adam: /adam/**
liquidnet-provider-sequence: /sequence/** liquidnet-service-kylin: /kylin/**
liquidnet-provider-data: /data/** # 忽略的服务,有些后端服务是不需要让网管代理的,防止服务侵入
liquidnet-provider-user: /user/** ignored-services: "*"
liquidnet-provider-p2m: /p2m/** # 忽略的接口,屏蔽接口
liquidnet-provider-activity: /activity/** # ignored-patterns: /**/div/**
pay-third-charge: /pay_charge/** # 以下为禁用某个过滤器
liquidnet-pay-query: /pay_query/** # XXXFilter: # 类的名字
liquidnet-client-app: /app_api/** # pre: # 类型
# disable: true
zuul.ThrowExceptionPostFilter.post.disable: true
logging: #解决错误 com.netflix.client.ClientException: Load balancer does not have available server for client:panfeng-item-service
level: #这样就可以即指定path与URL,又不破坏Zuul的Hystrix与Ribbon特性了。
com.netflix: debug #开启eureka负载均衡策略
ribbon:
#zuul: eureka:
# prefix: /api enabled: true # 为Ribbon禁用Eureka
# strip-prefix: false #liquidnet-service-sequence:
# ribbon:
# listOfServers: 192.168.137.1:9001
# -----------------------------------------------------------
...@@ -28,5 +28,14 @@ ...@@ -28,5 +28,14 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId> <artifactId>spring-cloud-starter-config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-common-service-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.liquidnet.support.zuul; package com.liquidnet.support.zuul;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy; import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@EnableDiscoveryClient @Slf4j
@EnableFeignClients
@EnableZuulProxy @EnableZuulProxy
@SpringBootApplication @SpringBootApplication(scanBasePackages = {"com.liquidnet"})
public class SupportZuulApplication { public class SupportZuulApplication implements CommandLineRunner {
@Autowired
private Environment environment;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(SupportZuulApplication.class, args); SpringApplication.run(SupportZuulApplication.class, args);
} }
@Override
public void run(String... strings) throws Exception {
try {
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\thttp://127.0.0.1:{}\n\t" +
"External: \thttp://{}:{}{}/doc.html\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
environment.getProperty("spring.application.name"),
environment.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
environment.getProperty("server.port"),
environment.getProperty("server.servlet.context-path"),
Arrays.toString(environment.getActiveProfiles()));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
} }
package com.liquidnet.support.zuul.config.swagger;
import org.springframework.cloud.netflix.zuul.filters.Route;
import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
import java.util.ArrayList;
import java.util.List;
@Primary
@Component
public class ZuulDocumentationConfig implements SwaggerResourcesProvider {
private final RouteLocator routeLocator;
public ZuulDocumentationConfig(RouteLocator routeLocator) {
this.routeLocator = routeLocator;
}
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> resources = new ArrayList<>();
List<Route> routes = routeLocator.getRoutes();
routes.forEach(route -> resources.add(
swaggerResource(route.getId(), route.getFullPath().replace("**", "v2/api-docs"))
));
// resources.add(swaggerResource("Adam", "/api/adam/v2/api-docs"));
// resources.add(swaggerResource("Kylin", "/api/kylin/v2/api-docs"));
return resources;
}
private SwaggerResource swaggerResource(String name, String location) {
SwaggerResource swaggerResource = new SwaggerResource();
swaggerResource.setName(name);
swaggerResource.setLocation(location);
swaggerResource.setSwaggerVersion("1.0");
return swaggerResource;
}
}
package com.liquidnet.support.zuul.config.swagger;
import com.liquidnet.common.swagger.config.Swagger2Config;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ZuulSwagger2Config extends Swagger2Config {
// @Override
// public ApiInfo apiInfo() {
// return new ApiInfoBuilder()
// .title("LiquidNet Services")
// .description("LiquidNet接口文档说明")
// .contact(new Contact("liquidnet", "", "**@liquidnet.io"))
// .version("1.0")
// .termsOfServiceUrl("http://localhost:8081")
// .build();
// }
//
// @Bean
// UiConfiguration uiConfig() {
// return new UiConfiguration(null, "list", "alpha", "schema",
// UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS, false, true, 60000L);
// }
}
package com.liquidnet.support.zuul.filter.error;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter;
import org.springframework.stereotype.Component;
/**
* 从POST抛出的异常,使用该过滤器返回错误信息
*/
@Component
public class ErrorExtFilter extends SendErrorFilter {
Logger log = LoggerFactory.getLogger(ErrorExtFilter.class);
@Override
public String filterType() {
return "error";
}
@Override
public int filterOrder() {
return 30;
}
@Override
public boolean shouldFilter() {
RequestContext ctx = RequestContext.getCurrentContext();
ZuulFilter failedFilter = (ZuulFilter) ctx.get("failed.filter");
if(failedFilter != null && failedFilter.filterType().equals("post")) {
return true;
}
return false;
}
}
package com.liquidnet.support.zuul.filter.error;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
/**
* 捕获为处理的异常统一做一些处理,让`SendErrorFilter`可以正确的返回异常信息
* 当是`post`过滤器抛出的话,错误信息会让`ErrorExtFilter`返回异常信息
*/
@Component
public class ErrorFilter extends ZuulFilter {
Logger log = LoggerFactory.getLogger(ErrorFilter.class);
@Override
public String filterType() {
return "error";
}
@Override
public int filterOrder() {
return 20;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
Throwable throwable = RequestContext.getCurrentContext().getThrowable();
log.error("this is a ErrorFilter : {}", throwable.getCause().getMessage());
ctx.set("error.status_code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
ctx.set("error.exception", throwable.getCause());
return null;
}
}
package com.liquidnet.support.zuul.filter.post;
import com.netflix.zuul.ZuulFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class ThrowExceptionPostFilter extends ZuulFilter {
private static Logger log = LoggerFactory.getLogger(ThrowExceptionPostFilter.class);
@Override
public String filterType() {
return "post";
}
@Override
public int filterOrder() {
return 10;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
log.info("This is a post filter, it will throw a RuntimeException");
doSomething();
return null;
}
private void doSomething() {
// throw new RuntimeException("Exist some errors...");
}
}
package com.liquidnet.support.zuul.filter.pre;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
@Component
public class ThrowExceptionFilter extends ZuulFilter {
private static Logger log = LoggerFactory.getLogger(ThrowExceptionFilter.class);
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 0;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
log.info("This is a pre filter, it will throw a RuntimeException");
RequestContext ctx = RequestContext.getCurrentContext();
try {
doSomething();
} catch (Exception e) {
ctx.set("error.status_code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
ctx.set("error.exception", e);
}
return null;
}
private void doSomething() {
// throw new RuntimeException("Exist some errors...");
}
}
liquidnet:
eureka:
# serviceUrl: 127.0.0.1:7001/eureka-server/eureka
serviceUrl: 192.168.31.229:7001/eureka-server/eureka
spring:
profiles:
include: zuul
\ No newline at end of file
spring:
application:
name: liquidnet-gateway-zuul
security:
basic:
enabled: true
user:
name: user
password: user123
server:
port: 7003
server:
tomcat:
accept-count: 500
max-threads: 500
min-spare-threads: 100
max-connections: 1000
connection-timeout: 5000
eureka:
client:
healthcheck:
enabled: true
register-with-eureka: true
fetch-registry: true
serviceUrl:
# defaultZone: ${liquidnet.eureka.serviceUrl}
defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@${liquidnet.eureka.serviceUrl}
instance:
hostname: ${spring.cloud.client.ip-address}
lease-expiration-duration-in-seconds: 15 #服务过期时间配置,超过这个时间没有接收到心跳EurekaServer就会将这个实例剔除
lease-renewal-interval-in-seconds: 5 #服务刷新时间配置,每隔这个时间会主动心跳一次
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}}
zuul:
prefix: /liquidnet-api
host:
max-per-route-connections: 1000
max-total-connections: 2000
routes:
liquidnet-service-adam: /adam/**
liquidnet-service-sequence: /sequence/**
liquidnet-service-example: /example/**
liquidnet-service-account: /account/**
liquidnet-service-task: /task/**
ThrowExceptionPostFilter:
post:
disable: true
#解决错误 com.netflix.client.ClientException: Load balancer does not have available server for client:panfeng-item-service
#这样就可以即指定path与URL,又不破坏Zuul的Hystrix与Ribbon特性了。
#开启eureka负载均衡策略
ribbon:
eureka:
enabled: false # 为Ribbon禁用Eureka
liquidnet-service-sequence:
ribbon:
listOfServers: 192.168.137.1:9001
logging:
level:
com.netflix: debug
#zuul:
# prefix: /api
# strip-prefix: false
/$$ /$$ /$$ /$$ /$$ /$$ /$$
| $$ |__/ |__/ | $$| $$$ | $$ | $$
| $$ /$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$$| $$$$| $$ /$$$$$$ /$$$$$$
| $$ | $$ /$$__ $$| $$ | $$| $$ /$$__ $$| $$ $$ $$ /$$__ $$|_ $$_/
| $$ | $$| $$ \ $$| $$ | $$| $$| $$ | $$| $$ $$$$| $$$$$$$$ | $$
| $$ | $$| $$ | $$| $$ | $$| $$| $$ | $$| $$\ $$$| $$_____/ | $$ /$$
| $$$$$$$$| $$| $$$$$$$| $$$$$$/| $$| $$$$$$$| $$ \ $$| $$$$$$$ | $$$$/
|________/|__/ \____ $$ \______/ |__/ \_______/|__/ \__/ \_______/ \___/
| $$
| $$
|__/
Application Version: ${application.version}${application.formatted-version}
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
# begin-dev-这里是配置信息基本值
liquidnet:
cloudConfig:
profile: dev
security:
username: user
password: user123
eureka:
host: 127.0.0.1:7001
# end-dev-这里是配置信息基本值
spring:
profiles:
include: support-zuul
\ No newline at end of file
## =================================================================== # begin-dev-这里是配置信息基本值
## Spring Cloud Config bootstrap configuration for the "dev" profile liquidnet:
## In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml cloudConfig:
## =================================================================== profile: prod
# security:
#spring: username: user
# application: password: user123
# name: liquidnet-gateway-zuul eureka:
# profiles: host: 127.0.0.1:7001
# active: prod # end-dev-这里是配置信息基本值
# cloud:
# config: spring:
# # name of the config server's property source (file.yml) that we want to use profiles:
# profile: prod # profile(s) of the property source include: service-zuul
# label: master # toggle to switch to a different version of the configuration as stored in git \ No newline at end of file
# uri: http://172.24.132.45:20001/
# # it can be set to any label, branch or commit of the config source git repository
#
#eurekaServer配置
eureka:
client:
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: http://${liquidnet.security.username}:${liquidnet.security.password}@${liquidnet.eureka.host}/eureka-server/eureka
#configServer配置
spring:
cloud:
config:
# uri: http://127.0.0.1:7002/support-config
profile: ${liquidnet.cloudConfig.profile}
name: ${spring.application.name} #默认为spring.application.name
discovery:
enabled: true
service-id: liquidnet-support-config
\ No newline at end of file
## =================================================================== # begin-dev-这里是配置信息基本值
## Spring Cloud Config bootstrap configuration for the "dev" profile liquidnet:
## In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml cloudConfig:
## =================================================================== profile: test
# security:
#spring: username: user
# application: password: user123
# name: liquidnet-gateway-zuul eureka:
# profiles: host: 172.18.0.2:7001
# active: test # end-dev-这里是配置信息基本值
# cloud:
# config: spring:
# label: ${spring.profiles.active1:dev} #当配置文件在git上时为分支名 profiles:
## profile: ${spring.profiles.active1:dev} #对应业务名称的profile include: service-zuul
# uri: http://172.24.133.63:20001/ \ No newline at end of file
## discovery: # 需要考虑 eureka 地址的初始化 先不使用
## enabled: true # 默认false,设为true表示使用注册中心中的configserver配置而不自己配置configserver的uri
## serviceId: liquidnet-config-service # 指定config server在服务发现中的serviceId,默认为:configserver
# spring:
#spring: application:
# application: name: liquidnet-support-zuul
# name: liquidnet-gateway-zuul profiles:
# profiles: active: dev
# active: dev
# cloud:
# config:
# label: ${spring.profiles.active1:dev} #当配置文件在git上时为分支名
## profile: ${spring.profiles.active1:dev} #对应业务名称的profile
# uri: http://172.24.132.45:20001/
## discovery: # 需要考虑 eureka 地址的初始化 先不使用
## enabled: true # 默认false,设为true表示使用注册中心中的configserver配置而不自己配置configserver的uri
## serviceId: liquidnet-config-service # 指定config server在服务发现中的serviceId,默认为:configserver
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="10 seconds">
<!-- Simple file output -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>
[ %-5level] [%date{yyyy-MM-dd HH:mm:ss}] %logger{96} [%line] - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily 配置日志所生成的目录以及生成文件名的规则 -->
<fileNamePattern>/data/logs/YGZX/dubbo/liquidnet-gateway-zuul/liquidnet-gateway-zuul-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<!-- Console output -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>
[ %-5level] [%date{yyyy-MM-dd HH:mm:ss}] %logger{96} [%line] - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- Only log level WARN and above -->
<!--<filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
<!--<level>WARN</level>-->
<!--</filter>-->
</appender>
<!-- Enable FILE and STDOUT appenders for all log messages.
By default, only log at level INFO and above. -->
<root level="INFO">
<appender-ref ref="FILE"/>
<appender-ref ref="STDOUT"/>
</root>
<!-- For loggers in the these namespaces, log at all levels. -->
<!--<logger name="pedestal" level="ALL"/>-->
<!--<logger name="hammock-cafe" level="ALL"/>-->
<!--<logger name="user" level="ALL"/>-->
</configuration>
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment