Compare commits
20 Commits
440544b0ff
...
master
Author | SHA1 | Date | |
---|---|---|---|
22fc150557 | |||
ac5aafcada | |||
48c4527c38 | |||
49a5223f7e | |||
11565a4311 | |||
d4b71bab78 | |||
da5eed39fb | |||
9ddb56fc7e | |||
dc70f38e29 | |||
bc409e516f | |||
f61dac4b61 | |||
6d8fcd0f30 | |||
8528f173a6 | |||
81acee7ce0 | |||
4e613004fc | |||
42cf919c30 | |||
9e472e204d | |||
8d92108589 | |||
9e060c0e80 | |||
e89ebd62b8 |
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
PORT=8889
|
||||
JAR_PATH="/home/zhangbiqiong/pro_eld_mqtt_compare/app/pro_eld_mqtt_compare-0.0.1-SNAPSHOT.jar"
|
||||
LOG_PATH="/home/zhangbiqiong/pro_eld_mqtt_compare/logs/pro_eld_mqtt_compare.log"
|
||||
JAR_PATH="/home/zhangbiqiong/pro_eld_mqtt_compare/target/pro_eld_mqtt_compare-0.0.1-SNAPSHOT.jar"
|
||||
|
||||
cd /home/zhangbiqiong/pro_eld_mqtt_compare || { echo "Failed to cd"; exit 1; }
|
||||
|
||||
# 检测端口是否被占用
|
||||
if netstat -tuln | grep -q ":$PORT"; then
|
||||
@@ -10,6 +11,6 @@ if netstat -tuln | grep -q ":$PORT"; then
|
||||
exit 0
|
||||
else
|
||||
echo "Port $PORT is free. Starting application..."
|
||||
nohup java -jar "$JAR_PATH" > "$LOG_PATH" 2>&1 &
|
||||
nohup java -jar "$JAR_PATH" > /dev/null 2>&1 &
|
||||
echo "Application started with PID $!"
|
||||
fi
|
@@ -15,7 +15,6 @@ else
|
||||
cd "$CODE_DIR" || { echo "[ERROR] 进入目录失败"; exit 1; }
|
||||
fi
|
||||
|
||||
# === 停止旧的 Java 应用 ===
|
||||
pid=$(ps -ef | grep -w java | grep "$JAR_NAME" | grep -v grep | awk '{print $2}')
|
||||
|
||||
if [ -z "$pid" ]; then
|
||||
|
22
pom.xml
22
pom.xml
@@ -17,6 +17,12 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -44,16 +50,6 @@
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
<version>3.3.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.19.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j2-impl</artifactId>
|
||||
<version>2.19.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
@@ -79,6 +75,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-integration</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 替换默认日志系统为 Log4j2 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
@@ -24,7 +24,7 @@ public class StartupCompareRunner implements ApplicationRunner {
|
||||
// compareService.compare(5, "vehicle");
|
||||
// compareService.compare(5, "device");
|
||||
// compareService.compare(5, "business");
|
||||
// compareService.compare(5, "driver");
|
||||
compareService.compare(5, "driver");
|
||||
// compareService.compare(5, "vehicle_device");
|
||||
// compareService.compare(5, "driver_vehicle");
|
||||
// compareService.compare(5, "business_driver");
|
||||
|
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -46,7 +47,8 @@ public class ApiService {
|
||||
public <T> Mono<List<T>> getInfoPakistan(GetInfoVO getInfoVO) {
|
||||
ParameterizedTypeReference<List<T>> typeRef = (ParameterizedTypeReference<List<T>>) tableObjectMapping.get(getInfoVO.getTableName());
|
||||
if (typeRef == null) {
|
||||
throw new IllegalArgumentException("不支持该表名: " + getInfoVO.getTableName());
|
||||
log.error("Pakistan API - 不支持该表名 : {}", getInfoVO.getTableName());
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
return webClientBuilder
|
||||
@@ -58,7 +60,11 @@ public class ApiService {
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.bodyValue(getInfoVO)
|
||||
.retrieve()
|
||||
.bodyToMono(typeRef);
|
||||
.bodyToMono(typeRef)
|
||||
.onErrorResume(e -> {
|
||||
log.warn("Pakistan API - WebClient 请求 eldData 失败,错误: {}", e.getMessage());
|
||||
return Mono.just(Collections.emptyList());
|
||||
});
|
||||
}
|
||||
|
||||
// Pro API
|
||||
@@ -66,7 +72,8 @@ public class ApiService {
|
||||
public <T> Mono<List<T>> getInfoPro(Integer customerId, String tableName) {
|
||||
ParameterizedTypeReference<List<T>> typeRef = (ParameterizedTypeReference<List<T>>) tableObjectMapping.get(tableName);
|
||||
if (typeRef == null) {
|
||||
throw new IllegalArgumentException("Unsupported table name: " + tableName);
|
||||
log.error("Pro API - 不支持该表名 : {}", tableName);
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
return webClientBuilder.baseUrl("https://eldapp.anytrek.app")
|
||||
@@ -79,6 +86,10 @@ public class ApiService {
|
||||
.build())
|
||||
.header("eldKey", "435e833ca0610442d25b8011475c8352")
|
||||
.retrieve()
|
||||
.bodyToMono(typeRef);
|
||||
.bodyToMono(typeRef)
|
||||
.onErrorResume(e -> {
|
||||
log.warn("Pro API - WebClient 请求 eldData 失败,错误: {}", e.getMessage());
|
||||
return Mono.just(Collections.emptyList());
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.ctgu.pro_eld_mqtt_compare.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName DriverConvertDTO
|
||||
* @Author Alex2
|
||||
* @Date 2025/7/23 9:59
|
||||
**/
|
||||
@Data
|
||||
public class DriverConvertDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String email;
|
||||
private String phone;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
// private String contactEmail;
|
||||
// private String contactPhone;
|
||||
// private String contactPhoneCountry;
|
||||
private Integer isDelete;
|
||||
private Integer customerId;
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package com.ctgu.pro_eld_mqtt_compare.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,11 +9,30 @@ import lombok.Data;
|
||||
* @Date 2025/7/4 15:19
|
||||
**/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DriverDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String email;
|
||||
private String phone;
|
||||
private Content content;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Content {
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String contactEmail;
|
||||
private ContactPhone contactPhone;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class ContactPhone {
|
||||
private String value;
|
||||
private String country;
|
||||
}
|
||||
}
|
||||
|
||||
private Integer isDelete;
|
||||
private Integer customerId;
|
||||
}
|
||||
|
@@ -3,11 +3,13 @@ package com.ctgu.pro_eld_mqtt_compare.service;
|
||||
import com.ctgu.pro_eld_mqtt_compare.api.ApiService;
|
||||
import com.ctgu.pro_eld_mqtt_compare.request.GetInfoVO;
|
||||
import com.ctgu.pro_eld_mqtt_compare.request.PublishMQTTVO;
|
||||
import com.ctgu.pro_eld_mqtt_compare.response.DriverConvertDTO;
|
||||
import com.ctgu.pro_eld_mqtt_compare.response.DriverDTO;
|
||||
import com.ctgu.pro_eld_mqtt_compare.utils.TAG;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -19,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
* @Author Alex2
|
||||
* @Date 2025/7/4 10:34
|
||||
**/
|
||||
@Slf4j
|
||||
@Log4j2
|
||||
@Service
|
||||
public class CompareService {
|
||||
|
||||
@@ -44,38 +46,122 @@ public class CompareService {
|
||||
CompareService.apiService = apiService;
|
||||
}
|
||||
|
||||
// 生成 value 组合
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 生成 value 组合
|
||||
*/
|
||||
private static String getValue(Map<String, Object> item, List<String> fieldNames) {
|
||||
return fieldNames.stream()
|
||||
.map(field -> String.valueOf(item.get(field)))
|
||||
.collect(Collectors.joining("-"));
|
||||
}
|
||||
|
||||
// 获取 value 字段
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 获取 value 字段
|
||||
*/
|
||||
private static List<String> getValueField(String tableName) {
|
||||
List<String> valueFields = KEY_FIELDS.get(tableName);
|
||||
if (valueFields == null) {
|
||||
throw new IllegalArgumentException("未配置字段列表: " + tableName);
|
||||
List<String> valueFields = null;
|
||||
try {
|
||||
valueFields = KEY_FIELDS.get(tableName);
|
||||
if (valueFields == null) {
|
||||
throw new IllegalArgumentException("未配置字段列表: " + tableName);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.error(e.getMessage());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return valueFields;
|
||||
}
|
||||
|
||||
// 比较
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 根据表名分发到 driver 或 common 处理
|
||||
*/
|
||||
public PublishMQTTVO compare(Integer customerId, String tableName) throws JsonProcessingException {
|
||||
// Pakistan API
|
||||
GetInfoVO driverVehicle = new GetInfoVO(customerId, tableName);
|
||||
List<Object> postResultList = apiService.getInfoPakistan(driverVehicle).block();
|
||||
List<Map<String, Object>> pakistanList = mapper.convertValue(postResultList, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
if ("driver".equalsIgnoreCase(tableName)) {
|
||||
return compareDriver(customerId, tableName);
|
||||
} else {
|
||||
return compareCommon(customerId, tableName);
|
||||
}
|
||||
}
|
||||
|
||||
// Pro API
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 处理 driver 表
|
||||
*/
|
||||
public PublishMQTTVO compareDriver(Integer customerId, String tableName) throws JsonProcessingException {
|
||||
// Pakistan 数据
|
||||
GetInfoVO getInfoVO = new GetInfoVO(customerId, tableName);
|
||||
List<Object> postResultList = apiService.getInfoPakistan(getInfoVO).block();
|
||||
List<DriverConvertDTO> pakistanDTOs = compareDriverTable(postResultList); // driver表特有的数据类型转换
|
||||
List<Map<String, Object>> pakistanList = mapper.convertValue(pakistanDTOs, new TypeReference<List<Map<String, Object>>>() {});
|
||||
|
||||
// Pro 数据
|
||||
List<Object> getResultList = apiService.getInfoPro(customerId, tableName).block();
|
||||
String json2 = mapper.writeValueAsString(getResultList);
|
||||
List<Map<String, Object>> proList = mapper.readValue(json2, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
List<DriverConvertDTO> proDTOs = compareDriverTable(getResultList); // driver表特有的数据类型转换
|
||||
List<Map<String, Object>> proList = mapper.convertValue(proDTOs, new TypeReference<List<Map<String, Object>>>() {});
|
||||
|
||||
return compareList(customerId, tableName, pakistanList, proList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 处理通用表(如 vehicle、device 等)
|
||||
*/
|
||||
public PublishMQTTVO compareCommon(Integer customerId, String tableName) throws JsonProcessingException {
|
||||
// Pakistan 数据
|
||||
GetInfoVO getInfoVO = new GetInfoVO(customerId, tableName);
|
||||
List<Object> postResultList = apiService.getInfoPakistan(getInfoVO).block();
|
||||
List<Map<String, Object>> pakistanList = mapper.convertValue(postResultList, new TypeReference<List<Map<String, Object>>>() {});
|
||||
|
||||
// Pro 数据
|
||||
List<Object> getResultList = apiService.getInfoPro(customerId, tableName).block();
|
||||
String json = mapper.writeValueAsString(getResultList);
|
||||
List<Map<String, Object>> proList = mapper.readValue(json, new TypeReference<List<Map<String, Object>>>() {});
|
||||
|
||||
return compareList(customerId, tableName, pakistanList, proList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 将 DriverDTO 列表转换为扁平结构 DriverConvertDTO 列表
|
||||
*/
|
||||
public List<DriverConvertDTO> compareDriverTable(List<Object> list) {
|
||||
List<DriverConvertDTO> driverConvertDTOS = new ArrayList<>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
if (list != null) {
|
||||
for (Object obj : list) {
|
||||
DriverDTO driverDTO = mapper.convertValue(obj, DriverDTO.class);
|
||||
|
||||
DriverConvertDTO dto = new DriverConvertDTO();
|
||||
dto.setId(driverDTO.getId());
|
||||
dto.setName(driverDTO.getName());
|
||||
dto.setEmail(driverDTO.getEmail());
|
||||
dto.setPhone(driverDTO.getPhone());
|
||||
dto.setCustomerId(driverDTO.getCustomerId());
|
||||
dto.setIsDelete(driverDTO.getIsDelete());
|
||||
|
||||
if (driverDTO.getContent() != null) {
|
||||
dto.setFirstName(driverDTO.getContent().getFirstName());
|
||||
dto.setLastName(driverDTO.getContent().getLastName());
|
||||
// dto.setContactEmail(driverDTO.getContent().getContactEmail());
|
||||
|
||||
// if (driverDTO.getContent().getContactPhone() != null) {
|
||||
// dto.setContactPhone(driverDTO.getContent().getContactPhone().getValue());
|
||||
// dto.setContactPhoneCountry(driverDTO.getContent().getContactPhone().getCountry());
|
||||
// }
|
||||
}
|
||||
|
||||
driverConvertDTOS.add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("driverConvertDTOS : {}", driverConvertDTOS);
|
||||
return driverConvertDTOS;
|
||||
}
|
||||
|
||||
// 比较列表
|
||||
// public void compareList(Integer customerId, String tableName, List<Map<String, Object>> pakistanList, List<Map<String, Object>> proList) {
|
||||
// List<String> valueFields = getValueField(tableName);
|
||||
@@ -102,15 +188,19 @@ public class CompareService {
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @Author: Alex
|
||||
* @Description: 比较两侧数据
|
||||
*/
|
||||
public PublishMQTTVO compareList(Integer customerId, String tableName, List<Map<String, Object>> pakistanList, List<Map<String, Object>> proList) {
|
||||
List<String> valueFields = getValueField(tableName);
|
||||
|
||||
Map<String, Map<String, Object>> pakistanMap = pakistanList.stream()
|
||||
.collect(Collectors.toMap(item -> getValue(item, valueFields), item -> item,(existing, replacement) -> existing));
|
||||
.collect(Collectors.toMap(item -> getValue(item, valueFields), item -> item, (existing, replacement) -> existing));
|
||||
log.info("customerId = {} - tableName = {} - pakistanSet = {}", customerId, tableName, pakistanMap.keySet());
|
||||
|
||||
Map<String, Map<String, Object>> proMap = proList.stream()
|
||||
.collect(Collectors.toMap(item -> getValue(item, valueFields), item -> item,(existing, replacement) -> existing));
|
||||
.collect(Collectors.toMap(item -> getValue(item, valueFields), item -> item, (existing, replacement) -> existing));
|
||||
log.info("customerId = {} - tableName = {} - proSet = {}", customerId, tableName, proMap.keySet());
|
||||
|
||||
// 合并所有 key
|
||||
@@ -123,7 +213,6 @@ public class CompareService {
|
||||
.filter(key -> !(pakistanMap.containsKey(key) && proMap.containsKey(key)))
|
||||
.map(key -> pakistanMap.getOrDefault(key, proMap.get(key))) // 取出差异项
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("customerId = {} - tableName = {} - differList = {}", customerId, tableName, diffList);
|
||||
|
||||
Set<Integer> differIds = diffList.stream()
|
||||
|
@@ -20,7 +20,7 @@ public abstract class TAG {
|
||||
public static final List<String> VEHICLE_FIELDS = Arrays.asList("id", "name", "isDelete", "customerId");
|
||||
public static final List<String> DEVICE_FIELDS = Arrays.asList("id", "userPackageId", "isDelete", "synTime", "customerId");
|
||||
public static final List<String> BUSINESS_FIELDS = Arrays.asList("id", "name", "isDelete", "customerId");
|
||||
public static final List<String> DRIVER_FIELDS = Arrays.asList("id", "name", "isDelete", "email", "phone", "customerId");
|
||||
public static final List<String> DRIVER_FIELDS = Arrays.asList("id", "name", "firstName", "lastName", "isDelete", "email", "phone", "customerId");
|
||||
public static final List<String> VEHICLE_DEVICE_FIELDS = Arrays.asList("id", "vehicleId", "deviceId", "isDelete", "customerId");
|
||||
public static final List<String> DRIVER_VEHICLE_FIELDS = Arrays.asList("id", "driverId", "vehicleId", "isDelete", "customerId");
|
||||
public static final List<String> BUSINESS_DRIVER_FIELDS = Arrays.asList("id", "businessId", "driverId", "isDelete", "customerId");
|
||||
|
@@ -1,5 +1,6 @@
|
||||
server:
|
||||
port: 8889
|
||||
address: 0.0.0.0
|
||||
mqtt:
|
||||
inbound:
|
||||
url: tcp://35.223.79.247:1883
|
||||
|
71
src/main/resources/log4j2.xml
Normal file
71
src/main/resources/log4j2.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- status:内部日志级别,monitorInterval:每30秒检测一次配置文件是否有变化,自动重载 -->
|
||||
<Configuration status="WARN" monitorInterval="30">
|
||||
<Properties>
|
||||
<!-- 日志输出目录 -->
|
||||
<Property name="LOG_HOME">logs</Property>
|
||||
|
||||
<!-- 通用日志输出格式 -->
|
||||
<Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Property>
|
||||
|
||||
<!-- 控制台日志格式(包含颜色) -->
|
||||
<Property name="CONSOLE_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight{%-5level} %logger{36} - %msg%n</Property>
|
||||
</Properties>
|
||||
|
||||
<Appenders>
|
||||
<!-- 控制台输出 -->
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="${CONSOLE_PATTERN}" charset="UTF-8" alwaysWriteExceptions="false" disableAnsi="false"/>
|
||||
</Console>
|
||||
|
||||
<!-- Info 日志文件,支持时间和大小滚动 -->
|
||||
<RollingFile name="InfoFile"
|
||||
fileName="${LOG_HOME}/app.log"
|
||||
filePattern="logs/%d{yyyy-MM-dd}/app-%i.log.gz">
|
||||
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||
|
||||
<Policies>
|
||||
<!-- 超过指定大小就切割 -->
|
||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||
<!-- 每天切割一次 -->
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
</Policies>
|
||||
|
||||
<!-- 最多保留30个历史文件 -->
|
||||
<DefaultRolloverStrategy max="30"/>
|
||||
|
||||
<!-- 只接收 info 及以上,但不包含 error(error 会被 error_file 接收) -->
|
||||
<Filters>
|
||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
</Filters>
|
||||
</RollingFile>
|
||||
|
||||
<!-- Error 日志文件,按时间/大小滚动 -->
|
||||
<RollingFile name="ErrorFile"
|
||||
fileName="${LOG_HOME}/error.log"
|
||||
filePattern="logs/%d{yyyy-MM-dd}/error-%i.log.gz">
|
||||
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
</Policies>
|
||||
|
||||
<DefaultRolloverStrategy max="30"/>
|
||||
|
||||
<!-- 只记录 error 级别日志 -->
|
||||
<Filters>
|
||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
</Filters>
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<!-- 默认全局日志级别,设为 info(低于 info 的日志不会打印) -->
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console"/>
|
||||
<AppenderRef ref="InfoFile"/>
|
||||
<AppenderRef ref="ErrorFile"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
Reference in New Issue
Block a user