提交 c39e6792 编写于 作者: 夏天飘过的风's avatar 夏天飘过的风

修改配置文件

上级 ddbc3b1d
无法预览此类型文件
......@@ -3,6 +3,7 @@
*/
package com.roncoo.education;
import com.roncoo.education.app.gateway.common.FilterPre;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
......@@ -11,8 +12,6 @@ import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import com.roncoo.education.server.gateway.common.FilterPre;
/**
* 服务网关
*
......@@ -22,26 +21,26 @@ import com.roncoo.education.server.gateway.common.FilterPre;
@SpringCloudApplication
public class ServerGatewayApplication {
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
config.setMaxAge(18000L);
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
public static void main(String[] args) {
SpringApplication.run(ServerGatewayApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(ServerGatewayApplication.class, args);
}
@Bean
public FilterPre filterPre() {
return new FilterPre();
}
@Bean
public FilterPre filterPre() {
return new FilterPre();
}
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
config.setMaxAge(18000L);
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}
/**
* Copyright 2015-现在 广州市领课网络科技有限公司
*/
package com.roncoo.education.server.gateway.common;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import com.netflix.zuul.exception.ZuulException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.StringUtils;
package com.roncoo.education.app.gateway.common;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import com.netflix.zuul.http.ServletInputStreamWrapper;
import com.roncoo.education.util.base.BaseException;
import com.roncoo.education.util.base.Result;
import com.roncoo.education.util.enums.RedisPreEnum;
import com.roncoo.education.util.enums.ResultEnum;
import com.roncoo.education.util.tools.JSONUtil;
import com.roncoo.education.util.tools.JWTUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.StringUtils;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
/**
* 请求开始前执行
......@@ -47,6 +44,51 @@ public class FilterPre extends ZuulFilter {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@SuppressWarnings("unchecked")
private static TreeMap<String, Object> getParamMap(HttpServletRequest request) {
TreeMap<String, Object> paramMap = new TreeMap<>();
Map<String, String[]> map = request.getParameterMap();
for (String key : map.keySet()) {
paramMap.put(key, map.get(key)[0]);
}
if (paramMap.isEmpty()) {
DataInputStream in = null;
try {
in = new DataInputStream(request.getInputStream());
byte[] buf = new byte[request.getContentLength()];
in.readFully(buf);
String t = new String(buf, "UTF-8");
if (StringUtils.hasText(t)) {
return new TreeMap<>(JSONUtil.parseObject(t, TreeMap.class));
}
} catch (Exception e) {
logger.error("获取不到任何参数");
} finally {
if (null != in)
try {
in.close();// 关闭数据流
} catch (IOException e) {
logger.error("关闭数据流异常");
}
}
}
return paramMap;
}
// 校验用户是否有权限
private static Boolean checkUri(String uri, String tk) {
List<String> menuVOList1 = JSONUtil.parseArray(tk, String.class);
if (StringUtils.hasText(uri) && uri.endsWith("/")) {
uri = uri.substring(0, uri.length() - 1);
}
for (String s : menuVOList1) {
if (s.contains(uri)) {
return true;
}
}
return false;
}
@Override
public String filterType() {
return FilterConstants.PRE_TYPE;
......@@ -138,11 +180,16 @@ public class FilterPre extends ZuulFilter {
}
// 单点登录处理,注意,登录的时候必须要放入缓存
/*
* if (!stringRedisTemplate.hasKey(userNo.toString())) { // 不存在,则登录异常,有效期为1小时 throw new BaseException(ResultEnum.TOKEN_PAST); }
*
* // 存在,判断是否token相同 String tk = stringRedisTemplate.opsForValue().get(userNo.toString()); if (!token.equals(tk)) { // 不同则为不同的用户登录,这时候提示异地登录 throw new BaseException(ResultEnum.REMOTE_ERROR); }
*/
// if (!stringRedisTemplate.hasKey(userNo.toString())) {
// // 不存在,则登录异常,有效期为1小时
// throw new BaseException(ResultEnum.TOKEN_PAST);
// }
// // 存在,判断是否token相同
// String tk = stringRedisTemplate.opsForValue().get(userNo.toString());
// if (!token.equals(tk)) {
// // 不同则为不同的用户登录,这时候提示异地登录
// throw new BaseException(ResultEnum.REMOTE_ERROR);
// }
// 更新时间,使token不过期
stringRedisTemplate.opsForValue().set(userNo.toString(), token, 1, TimeUnit.HOURS);
......@@ -178,49 +225,4 @@ public class FilterPre extends ZuulFilter {
}
};
}
@SuppressWarnings("unchecked")
private static TreeMap<String, Object> getParamMap(HttpServletRequest request) {
TreeMap<String, Object> paramMap = new TreeMap<>();
Map<String, String[]> map = request.getParameterMap();
for (String key : map.keySet()) {
paramMap.put(key, map.get(key)[0]);
}
if (paramMap.isEmpty()) {
DataInputStream in = null;
try {
in = new DataInputStream(request.getInputStream());
byte[] buf = new byte[request.getContentLength()];
in.readFully(buf);
String t = new String(buf, "UTF-8");
if (StringUtils.hasText(t)) {
return new TreeMap<>(JSONUtil.parseObject(t, TreeMap.class));
}
} catch (Exception e) {
logger.error("获取不到任何参数");
} finally {
if (null != in)
try {
in.close();// 关闭数据流
} catch (IOException e) {
logger.error("关闭数据流异常");
}
}
}
return paramMap;
}
// 校验用户是否有权限
private static Boolean checkUri(String uri, String tk) {
List<String> menuVOList1 = JSONUtil.parseArray(tk, String.class);
if (StringUtils.hasText(uri) && uri.endsWith("/")) {
uri = uri.substring(0, uri.length() - 1);
}
for (String s : menuVOList1) {
if (s.contains(uri)) {
return true;
}
}
return false;
}
}
package com.roncoo.education.server.gateway.controller;
package com.roncoo.education.app.gateway.controller;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import com.roncoo.education.util.base.Result;
import com.roncoo.education.util.enums.ResultEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
@Slf4j
@RestController
public class HandlerController implements ErrorController {
/**
* 出异常后进入该方法,交由下面的方法处理
*/
@Override
public String getErrorPath() {
return "/error";
}
/**
* 出异常后进入该方法,交由下面的方法处理
*/
@Override
public String getErrorPath() {
return "/error";
}
@RequestMapping("/error")
@ResponseStatus(HttpStatus.OK)
public Result<String> error() {
RequestContext ctx = RequestContext.getCurrentContext();
Throwable throwable = ctx.getThrowable();
if(null != throwable && throwable instanceof ZuulException ){
ZuulException e = (ZuulException) ctx.getThrowable();
return Result.error(e.nStatusCode, e.errorCause);
}
return Result.error(ResultEnum.ERROR);
}
@RequestMapping("/error")
@ResponseStatus(HttpStatus.OK)
public Result<String> error() {
RequestContext ctx = RequestContext.getCurrentContext();
Throwable throwable = ctx.getThrowable();
log.error("系统异常", throwable);
if (null != throwable && throwable instanceof ZuulException) {
ZuulException e = (ZuulException) ctx.getThrowable();
return Result.error(e.nStatusCode, e.errorCause);
}
return Result.error(ResultEnum.ERROR);
}
}
/**
* Copyright 2015-现在 广州市领课网络科技有限公司
*/
package com.roncoo.education.server.gateway.controller;
package com.roncoo.education.app.gateway.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class IndexController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
return "index";
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
return "index";
}
}
# application
spring.application.name=roncoo-education-app-gateway
# profile
spring.profiles.active=dev
spring.profiles.active=demo
# server
server.port=5840
# nacos
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos
spring.cloud.nacos.server-addr=localhost:8848
spring.cloud.nacos.password=RonCoo.123
spring.cloud.nacos.server-addr=10.65.3.98:8848
spring.cloud.nacos.namespace=${spring.profiles.active}
spring.cloud.nacos.discovery.namespace=${spring.cloud.nacos.namespace}
spring.cloud.nacos.config.namespace=${spring.cloud.nacos.namespace}
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>接口文档</title>
<meta charset="UTF-8">
<title>接口文档</title>
</head>
<body>
<div style="margin:0 auto;text-align:center;">
<div style="margin:0 auto;text-align:center;">
<br/>
<a href="http://192.168.1.75:5710/doc.html" target="_blanck">课程API</a>
<a href="http://localhost:5710/doc.html" target="_blanck">课程API</a>
<br/>
<br/>
<a href="http://192.168.1.75:5720/doc.html" target="_blanck">用户API</a>
<a href="http://localhost:5720/doc.html" target="_blanck">用户API</a>
<br/>
<br/>
<a href="http://192.168.1.75:5730/doc.html" target="_blanck">系统API</a>
</div>
<a href="http://localhost:5730/doc.html" target="_blanck">系统API</a>
</div>
</body>
</html>
package com.roncoo.education.server.job;
package com.roncoo.education.app.job;
import com.roncoo.education.system.feign.interfaces.IFeignMsg;
import com.roncoo.education.util.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.roncoo.education.util.base.BaseController;
/**
* 站内信-定时发送
*
* @author wuyun
*
*/
@Component
public class MsgSendCrontab extends BaseController {
private static final Object KEY = new Object();
private static boolean taskFlag = false;
@Autowired
private IFeignMsg bossMsg;
/**
* 定时任务,一小时启动一次
*
* @author wuyun
*/
@Scheduled(fixedRate = 60000)
public void pushCancel() {
synchronized (KEY) {
if (MsgSendCrontab.taskFlag) {
logger.warn("站内信-定时发送已经启动");
return;
}
MsgSendCrontab.taskFlag = true;
}
try {
bossMsg.push();
} catch (Exception e) {
logger.error("站内信-定时发送-执行出错", e);
}
MsgSendCrontab.taskFlag = false;
logger.warn("站内信-定时发送-任务完成");
}
private static final Object KEY = new Object();
private static boolean taskFlag = false;
@Autowired
private IFeignMsg bossMsg;
/**
* 定时任务,一小时启动一次
*
* @author wuyun
*/
@Scheduled(fixedRate = 60000)
public void pushCancel() {
synchronized (KEY) {
if (MsgSendCrontab.taskFlag) {
logger.warn("站内信-定时发送已经启动");
return;
}
MsgSendCrontab.taskFlag = true;
}
try {
bossMsg.push();
} catch (Exception e) {
logger.error("站内信-定时发送-执行出错", e);
}
MsgSendCrontab.taskFlag = false;
logger.warn("站内信-定时发送-任务完成");
}
}
package com.roncoo.education.server.job;
package com.roncoo.education.app.job;
import com.roncoo.education.course.feign.interfaces.IFeignOrderInfo;
import com.roncoo.education.util.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.roncoo.education.util.base.BaseController;
/**
* 定时任务-订单处理
*
......@@ -15,33 +14,33 @@ import com.roncoo.education.util.base.BaseController;
@Component
public class OrderCrontab extends BaseController {
private static final Object KEY = new Object();
private static boolean taskFlag = false;
@Autowired
private IFeignOrderInfo feignOrderInfo;
/**
* 定时任务每分钟执行一次
*/
@Scheduled(fixedRate = 60000)
public void orderCancel() {
synchronized (KEY) {
if (OrderCrontab.taskFlag) {
logger.warn("订单处理-任务已经启动");
return;
}
OrderCrontab.taskFlag = true;
}
logger.warn("订单处理-定时任务开始");
try {
feignOrderInfo.handleScheduledTasks();
} catch (Exception e) {
logger.error("定时任务-订单处理-执行出错", e);
}
OrderCrontab.taskFlag = false;
}
private static final Object KEY = new Object();
private static boolean taskFlag = false;
@Autowired
private IFeignOrderInfo feignOrderInfo;
/**
* 定时任务每分钟执行一次
*/
@Scheduled(fixedRate = 60000)
public void orderCancel() {
synchronized (KEY) {
if (OrderCrontab.taskFlag) {
logger.warn("订单处理-任务已经启动");
return;
}
OrderCrontab.taskFlag = true;
}
logger.warn("订单处理-定时任务开始");
try {
feignOrderInfo.handleScheduledTasks();
} catch (Exception e) {
logger.error("定时任务-订单处理-执行出错", e);
}
OrderCrontab.taskFlag = false;
}
}
package com.roncoo.education.app.job;
import com.roncoo.education.course.feign.interfaces.IFeignCourseVideo;
import com.roncoo.education.util.base.BaseController;
import com.roncoo.education.util.config.SystemUtil;
import com.xiaoleilu.hutool.io.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.File;
/**
* 定时任务-视频处理
*
* @author wuyun
*/
@Component
public class VideoCrontab extends BaseController {
private static final Object KEY = new Object();
private static boolean taskFlag = false;
@Autowired
private IFeignCourseVideo feignCourseVideo;
/**
* 定时任务每分钟执行一次 <br/>
* 注意:每个course服务都必须要对应有一个定时任务,针对服务器
*/
@Scheduled(fixedRate = 60000)
public void orderCancel() {
synchronized (KEY) {
if (VideoCrontab.taskFlag) {
logger.warn("视频处理-任务已经启动");
return;
}
VideoCrontab.taskFlag = true;
}
int videoSum = 0;
File file = new File(SystemUtil.PERIOD_VIDEO_PATH);
if (file.isDirectory()) {// isDirectory是否文件夹
File[] files = file.listFiles();// listFiles是获取该目录下所有文件和目录的绝对路径
for (File targetFile : files) {
if (targetFile.isFile() && targetFile.exists()) {
if (FileUtil.newerThan(targetFile, (System.currentTimeMillis() - 7200000))) {// 上传两个小时内
try {
feignCourseVideo.handleScheduledTasks(targetFile);
videoSum = videoSum + 1;
} catch (Exception e) {
logger.error("视频定时任务处理失败", e);
}
}
}
}
}
VideoCrontab.taskFlag = false;
logger.warn("视频处理-定时任务完成,处理视频数={}", videoSum);
}
}
package com.roncoo.education.server.job;
import java.io.File;
import com.roncoo.education.course.feign.interfaces.IFeignCourseVideo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.roncoo.education.util.base.BaseController;
import com.roncoo.education.util.config.SystemUtil;
import com.xiaoleilu.hutool.io.FileUtil;
/**
* 定时任务-视频处理
*
* @author wuyun
*/
@Component
public class VideoCrontab extends BaseController {
private static final Object KEY = new Object();
private static boolean taskFlag = false;
@Autowired
private IFeignCourseVideo feignCourseVideo;
/**
* 定时任务每分钟执行一次 <br/>
* 注意:每个course服务都必须要对应有一个定时任务,针对服务器
*/
@Scheduled(fixedRate = 60000)
public void orderCancel() {
synchronized (KEY) {
if (VideoCrontab.taskFlag) {
logger.warn("视频处理-任务已经启动");
return;
}
VideoCrontab.taskFlag = true;
}
int videoSum = 0;
File file = new File(SystemUtil.PERIOD_VIDEO_PATH);
if (file.isDirectory()) {// isDirectory是否文件夹
File[] files = file.listFiles();// listFiles是获取该目录下所有文件和目录的绝对路径
for (File targetFile : files) {
if (targetFile.isFile() && targetFile.exists()) {
if (FileUtil.newerThan(targetFile, (System.currentTimeMillis() - 7200000))) {// 上传两个小时内
try {
feignCourseVideo.handleScheduledTasks(targetFile);
videoSum = videoSum + 1;
} catch (Exception e) {
logger.error("视频定时任务处理失败", e);
}
}
}
}
}
VideoCrontab.taskFlag = false;
logger.warn("视频处理-定时任务完成,处理视频数={}", videoSum);
}
}
/**
* Copyright 2015-现在 广州市领课网络科技有限公司
*/
package com.roncoo.education.server.sba;
package com.roncoo.education.app.sba;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
@EnableAdminServer
@EnableDiscoveryClient
@SpringBootApplication
public class ServerSbaApplication {
public static void main(String[] args) {
SpringApplication.run(ServerSbaApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(ServerSbaApplication.class, args);
}
}
package com.roncoo.education.server.sba.config;
package com.roncoo.education.app.sba.config;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
@Configuration
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
private final String adminContextPath;
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/");
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/");
http.authorizeRequests().antMatchers(adminContextPath + "/assets/**").permitAll().antMatchers(adminContextPath + "/login").permitAll().anyRequest().authenticated().and().formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and().logout().logoutUrl(adminContextPath + "/logout").and().httpBasic().and().csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).ignoringAntMatchers(adminContextPath + "/instances", adminContextPath + "/actuator/**");
// @formatter:on
}
}
\ No newline at end of file
http.authorizeRequests().antMatchers(adminContextPath + "/assets/**").permitAll().antMatchers(adminContextPath + "/login").permitAll().anyRequest().authenticated().and().formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and().logout().logoutUrl(adminContextPath + "/logout").and().httpBasic().and().csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).ignoringAntMatchers(adminContextPath + "/instances", adminContextPath + "/actuator/**");
// @formatter:on
}
}
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<springProperty name="springApplicationName" source="spring.application.name" defaultValue="roncoo-education"/>
<springProperty name="FILE_PATH" source="management.endpoint.logfile.external-file" defaultValue="/home/roncoo/logs"/>
<springProperty name="FILE_PATH" source="management.endpoint.logfile.external-file"
defaultValue="/home/roncoo/logs"/>
<property name="PATTERN" value="%-12(%d{yyyy-MM-dd HH:mm:ss.SSS}) |-%-5level [%thread] %c [%L] -| %msg%n"/>
......@@ -14,16 +15,16 @@
<pattern>${PATTERN}</pattern>
</encoder>
</appender>
<logger name="com.roncoo" level="debug" />
<logger name="org.springframework.cloud.netflix.zuul" level="debug" />
<logger name="org.springframework.jdbc.core.JdbcTemplate" level="debug" />
<logger name="com.roncoo" level="debug"/>
<logger name="org.springframework.cloud.netflix.zuul" level="debug"/>
<logger name="org.springframework.jdbc.core.JdbcTemplate" level="debug"/>
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<springProfile name="dev,test,demo">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${PATTERN}</pattern>
......@@ -44,13 +45,13 @@
</layout>
</appender>
<logger name="com.roncoo" level="debug" />
<logger name="org.springframework.cloud.netflix.zuul" level="debug" />
<logger name="org.springframework.jdbc.core.JdbcTemplate" level="debug" />
<logger name="com.roncoo" level="debug"/>
<logger name="org.springframework.cloud.netflix.zuul" level="debug"/>
<logger name="org.springframework.jdbc.core.JdbcTemplate" level="debug"/>
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="TEST-FILE" />
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TEST-FILE"/>
</root>
</springProfile>
......@@ -98,10 +99,10 @@
</encoder>
</appender>
<logger name="com.roncoo" level="warn" />
<logger name="com.roncoo" level="warn"/>
<root level="warn">
<appender-ref ref="PROD_FILE" />
<appender-ref ref="PROD_FILE"/>
<!--<appender-ref ref="LOGSTASH" />-->
</root>
</springProfile>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册