Compare commits
5 Commits
fefc7b04f2
...
e7ce39d31b
Author | SHA1 | Date |
---|---|---|
|
e7ce39d31b | |
|
e94800c28a | |
|
06edeac343 | |
|
42d717f06e | |
|
7ad4101e39 |
|
@ -9,6 +9,9 @@ target/
|
|||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Logs ###
|
||||
logs
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -28,8 +28,8 @@ public class RuleData extends BaseEntity {
|
|||
/**
|
||||
* 规则ID
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableId(value = "rule_id",type = IdType.AUTO)
|
||||
private Long ruleId;
|
||||
/**
|
||||
* 规则分类
|
||||
*/
|
||||
|
@ -39,17 +39,13 @@ public class RuleData extends BaseEntity {
|
|||
*/
|
||||
private String ruleName;
|
||||
/**
|
||||
* 规则代码
|
||||
* 规则类型
|
||||
*/
|
||||
private String ruleCode;
|
||||
private String ruleType;
|
||||
/**
|
||||
* 规则说明
|
||||
* 规则作用域
|
||||
*/
|
||||
private String ruleExplain;
|
||||
/**
|
||||
* 响应示例
|
||||
*/
|
||||
private String ruleRespond;
|
||||
private String ruleRegion;
|
||||
/**
|
||||
* 规则状态
|
||||
*/
|
||||
|
@ -57,12 +53,11 @@ public class RuleData extends BaseEntity {
|
|||
|
||||
public static RuleData updBuild(RuleDataUpdReq ruleDataUpdReq, Supplier<Long> idSupplier) {
|
||||
return RuleData.builder()
|
||||
.id(idSupplier.get())
|
||||
.ruleId(idSupplier.get())
|
||||
.ruleClassify(ruleDataUpdReq.getRuleClassify())
|
||||
.ruleName(ruleDataUpdReq.getRuleName())
|
||||
.ruleCode(ruleDataUpdReq.getRuleCode())
|
||||
.ruleExplain(ruleDataUpdReq.getRuleExplain())
|
||||
.ruleRespond(ruleDataUpdReq.getRuleRespond())
|
||||
.ruleType(ruleDataUpdReq.getRuleType())
|
||||
.ruleRegion(ruleDataUpdReq.getRuleRegion())
|
||||
.ruleStatus(ruleDataUpdReq.getRuleStatus())
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -25,15 +25,15 @@ public class RuleDataClassify extends BaseEntity {
|
|||
/**
|
||||
* 类型ID
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long ruleId;
|
||||
@TableId(value = "rule_data_classify_id",type = IdType.AUTO)
|
||||
private Long ruleDataClassifyId;
|
||||
/**
|
||||
* 规则类型名称
|
||||
*/
|
||||
private String ruleRemark;
|
||||
private String ruleTypeName;
|
||||
/**
|
||||
* 规则类型状态(是否启用)
|
||||
* 规则类型描述
|
||||
*/
|
||||
private String ruleClassify;
|
||||
private String ruleTypeDescription;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.common.domain
|
||||
* @Project:cloud-rule
|
||||
* @name:RuleVersion
|
||||
* @Date:2024/8/23 上午11:43
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "rule_version")
|
||||
public class RuleVersion extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 规则版本ID
|
||||
*/
|
||||
@TableId(value = "rule_version_id",type = IdType.AUTO)
|
||||
private Long ruleVersionId ;
|
||||
/**
|
||||
* 版本类
|
||||
*/
|
||||
private String ruleVersionType ;
|
||||
/**
|
||||
* 版本名称
|
||||
*/
|
||||
private String ruleVersionName ;
|
||||
/**
|
||||
* 版本编号
|
||||
*/
|
||||
private String ruleVersionCode ;
|
||||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
private String ruleVersionActivate ;
|
||||
/**
|
||||
* 版本状态
|
||||
*/
|
||||
private String ruleVersionStatus ;
|
||||
/**
|
||||
* 是否测试
|
||||
*/
|
||||
private String ruleVersionTest ;
|
||||
/**
|
||||
* 代码
|
||||
*/
|
||||
private String ruleVersionText ;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String ruleVersionRemark ;
|
||||
|
||||
}
|
|
@ -2,6 +2,8 @@ package com.muyu.common.domain.req;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.validation.custom.IsSysRuleRegion;
|
||||
import com.muyu.common.core.validation.custom.IsSysRuleZM;
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
@ -36,20 +38,19 @@ public class RuleDataUpdReq {
|
|||
,description = "规则名称一般为类型名称,方便使用者进行区分" ,requiredProperties = {"ruleName"})
|
||||
private String ruleName;
|
||||
/**
|
||||
* 规则代码
|
||||
* 规则类型
|
||||
*/
|
||||
@Schema(title = "规则代码",type = "String")
|
||||
private String ruleCode;
|
||||
@NotEmpty(message = "规则类型不可为空")
|
||||
@IsSysRuleZM //判断 Z 自定义规则 M 模板规则
|
||||
@Schema(description = "规则类型",defaultValue = "Z",type = "String")
|
||||
private String ruleType;
|
||||
/**
|
||||
* 规则说明
|
||||
* 规则作用域
|
||||
*/
|
||||
@Schema(title = "规则说明",type = "String")
|
||||
private String ruleExplain;
|
||||
/**
|
||||
* 响应示例
|
||||
*/
|
||||
@Schema(title = "响应示例",type = "String")
|
||||
private String ruleRespond;
|
||||
@NotEmpty(message = "规则作用域不可为空")
|
||||
@IsSysRuleRegion
|
||||
@Schema(description = "规则作用域",defaultValue = "数据字段",type = "String")
|
||||
private String ruleRegion;
|
||||
/**
|
||||
* 规则状态
|
||||
*/
|
||||
|
|
|
@ -40,20 +40,15 @@ public class RuleDataResp {
|
|||
@Schema(description = "规则名称",defaultValue = "邮箱规则接口",type = "String")
|
||||
private String ruleName;
|
||||
/**
|
||||
* 规则代码
|
||||
* 规则类型
|
||||
*/
|
||||
@Schema(description = "规则代码",defaultValue = "sql",type = "String")
|
||||
private String ruleCode;
|
||||
@Schema(description = "规则类型",defaultValue = "邮箱校验",type = "String")
|
||||
private String ruleType;
|
||||
/**
|
||||
* 规则说明
|
||||
* 规则作用域
|
||||
*/
|
||||
@Schema(description = "规则说明",defaultValue = "说明123",type = "String")
|
||||
private String ruleExplain;
|
||||
/**
|
||||
* 响应示例
|
||||
*/
|
||||
@Schema(description = "响应示例",defaultValue = "json{...}",type = "String")
|
||||
private String ruleRespond;
|
||||
@Schema(description = "规则作用域",defaultValue = "数据字段",type = "String")
|
||||
private String ruleRegion;
|
||||
/**
|
||||
* 规则状态
|
||||
*/
|
||||
|
@ -73,11 +68,10 @@ public class RuleDataResp {
|
|||
|
||||
public static RuleDataResp ruleDataBuild(RuleData ruleData, Supplier<List<RuleDataResp>> function) {
|
||||
return RuleDataResp.builder()
|
||||
.id(ruleData.getId())
|
||||
.id(ruleData.getRuleId())
|
||||
.ruleName(ruleData.getRuleName())
|
||||
.ruleCode(ruleData.getRuleCode())
|
||||
.ruleExplain(ruleData.getRuleExplain())
|
||||
.ruleRespond(ruleData.getRuleRespond())
|
||||
.ruleType(ruleData.getRuleType())
|
||||
.ruleRegion(ruleData.getRuleRegion())
|
||||
.ruleStatus(ruleData.getRuleStatus())
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @Date:2024/8/22 下午7:49
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableMyFeignClients
|
||||
public class MuYuRuleDataApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuRuleDataApplication.class, args);
|
||||
|
|
|
@ -44,66 +44,69 @@ public class RuleDataController {
|
|||
);
|
||||
}
|
||||
|
||||
// @PostMapping("/add")
|
||||
// @Operation(summary = "添加",description = "根据用户")
|
||||
|
||||
/**
|
||||
* 修改接口规则
|
||||
* @param id
|
||||
* @param ruleId
|
||||
* @param ruleDataUpdReq
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping("/upd/{id}")
|
||||
@PutMapping("/upd/{ruleId}")
|
||||
@Operation(summary = "接口规则修改",description = "通过ID修改接口规则信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户ID",type = "Long",defaultValue = "1",description = "修改接口规则信息需要唯一条件")
|
||||
@PathVariable("id") Long id,
|
||||
@PathVariable("ruleId") Long ruleId,
|
||||
@Validated @RequestBody RuleDataUpdReq ruleDataUpdReq){
|
||||
ruleDataService.updateById(RuleData.updBuild(ruleDataUpdReq,() -> id));
|
||||
ruleDataService.updateById(RuleData.updBuild(ruleDataUpdReq,() -> ruleId));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除接口规则
|
||||
* @param id 请求ID
|
||||
* @param ruleId 请求ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/del/{id}")
|
||||
@DeleteMapping("/del/{ruleId}")
|
||||
@Operation(summary = "接口规则删除",description = "通过ID删除接口规则")
|
||||
public Result<String> delete(@PathVariable("id") Long id){
|
||||
ruleDataService.getOptById(id);
|
||||
public Result<String> delete(@PathVariable("ruleId") Long ruleId){
|
||||
ruleDataService.getOptById(ruleId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取接口规则信息
|
||||
* @param id 请求ID
|
||||
* @param ruleId 请求ID
|
||||
* @return 规则信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@GetMapping("/{ruleId}")
|
||||
@Operation(summary = "根据ID获取客户信息",description = "通过ID获取接口规则信息")
|
||||
public Result<RuleData> findById(@PathVariable("id") Long id){
|
||||
return Result.success(ruleDataService.getById(id),"操作成功");
|
||||
public Result<RuleData> findById(@PathVariable("ruleId") Long ruleId){
|
||||
return Result.success(ruleDataService.getById(ruleId),"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
*通过ID禁用规则
|
||||
* @param id 请求ID
|
||||
* @param ruleId 请求ID
|
||||
* @return 禁用结果
|
||||
*/
|
||||
@GetMapping("/disable/{id}")
|
||||
@GetMapping("/disable/{ruleId}")
|
||||
@Operation(summary = "通过ID禁用规则",description = "通过ID禁用规则之后,禁止用户在使用此规则")
|
||||
public Result<String> disable(@PathVariable("id") Long id){
|
||||
this.ruleDataService.disable(id);
|
||||
public Result<String> disable(@PathVariable("ruleId") Long ruleId){
|
||||
this.ruleDataService.disable(ruleId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
*通过ID启动规则
|
||||
* @param id 请求ID
|
||||
* @param ruleId 请求ID
|
||||
* @return 启动结果
|
||||
*/
|
||||
@GetMapping("/enable/{id}")
|
||||
@GetMapping("/enable/{ruleId}")
|
||||
@Operation(summary = "通过ID启动规则",description = "通过ID禁用规则之后,禁止用户在使用此规则")
|
||||
public Result<String> enable(@PathVariable("id") Long id){
|
||||
this.ruleDataService.enable(id);
|
||||
public Result<String> enable(@PathVariable("ruleId") Long ruleId){
|
||||
this.ruleDataService.enable(ruleId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@ import java.util.List;
|
|||
public interface RuleDataService extends IService<RuleData> {
|
||||
List<RuleDataResp> selectList(RuleDataListReq ruleDataListReq);
|
||||
|
||||
void disable(Long id);
|
||||
void disable(Long ruleId);
|
||||
|
||||
void enable(Long id);
|
||||
void enable(Long ruleId);
|
||||
|
||||
/**
|
||||
* 通过规则ID设置规则状态
|
||||
* @param id ID
|
||||
* @param ruleId ID
|
||||
* @param status 状态 SysIsYesNo
|
||||
*/
|
||||
public void settingStatus(Long id, String status);
|
||||
public void settingStatus(Long ruleId, String status);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,6 @@ public class RuleDataServiceImpl
|
|||
extends ServiceImpl<RuleDataMapper, RuleData>
|
||||
implements RuleDataService {
|
||||
|
||||
@Autowired private RuleDataMapper ruleDataMapper;
|
||||
@Autowired private RuleDataService ruleDataService;
|
||||
@Autowired private RuleDataInfoService ruleDataInfoService;
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +49,7 @@ public class RuleDataServiceImpl
|
|||
List<RuleData> ruleDataList = this.list(queryWrapper);
|
||||
return ruleDataList.stream()
|
||||
.map(ruleData -> RuleDataResp.ruleDataBuild(ruleData,() ->
|
||||
ruleDataInfoService.selectRuleDataAndLimit(ruleData.getId(),5)
|
||||
ruleDataInfoService.selectRuleDataAndLimit(ruleData.getRuleId(),5)
|
||||
.stream()
|
||||
.toList()
|
||||
))
|
||||
|
@ -59,19 +57,19 @@ public class RuleDataServiceImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void disable(Long id) {
|
||||
this.settingStatus(id, SystemYesNo.NO.getCode());
|
||||
public void disable(Long ruleId) {
|
||||
this.settingStatus(ruleId, SystemYesNo.NO.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(Long id) {
|
||||
this.settingStatus(id, SystemYesNo.YES.getCode());
|
||||
public void enable(Long ruleId) {
|
||||
this.settingStatus(ruleId, SystemYesNo.YES.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingStatus(Long id, String status) {
|
||||
public void settingStatus(Long ruleId, String status) {
|
||||
LambdaQueryWrapper<RuleData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(RuleData::getId,id);
|
||||
queryWrapper.eq(RuleData::getRuleId,ruleId);
|
||||
boolean isExists = this.exists(queryWrapper);
|
||||
if (!isExists) {
|
||||
throw new ServiceException("操作规则不存在");
|
||||
|
@ -80,7 +78,7 @@ public class RuleDataServiceImpl
|
|||
throw new ServiceException("设置状态值违法");
|
||||
}
|
||||
LambdaUpdateWrapper<RuleData> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(RuleData::getId,id);
|
||||
updateWrapper.eq(RuleData::getRuleId,ruleId);
|
||||
updateWrapper.set(RuleData::getRuleStatus,status);
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,56 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9709
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 21.12.0.8:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: ec66ecf1-f28e-43bc-aa86-625f1bc53bf8
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: cloud-rule
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
config:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# xxl-job 配置文件
|
||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# rabbitMQ 配置文件
|
||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-integration"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-integration"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-integration"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
Loading…
Reference in New Issue