From 25fa475f29791e80a2b533f8f52a9459bcce6a96 Mon Sep 17 00:00:00 2001
From: zhangjian <zhangjianrock@163.com>
Date: 星期六, 05 八月 2023 10:04:20 +0800
Subject: [PATCH] 加入日志
---
ruoyi-admin/src/main/resources/logback.xml | 15 +++++++++++++++
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java | 6 ++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java b/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
index 5af9367..783e0c0 100644
--- a/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
@@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.utils.forest.UavClient;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
@@ -21,6 +22,7 @@
import java.util.Map;
@Service
+@Slf4j(topic = "uav")
public class UavService {
public static final String USERNAME = "ardbailu";//鐢ㄦ埛鍚�
public static final String PASSWORD = "ardkj12345";//瀵嗙爜
@@ -70,14 +72,14 @@
}
public Map getUavUser() {
- if (this.uavUser==null){
+ if (this.uavUser == null) {
this.login();
}
return this.uavUser;
}
public void login() {
- System.out.println("鐧诲綍鏃犱汉鏈哄閮ㄦ帴鍙�");
+ log.debug("鐧诲綍鏃犱汉鏈哄閮ㄦ帴鍙�");
String codedPassword = this.Encrypt(PASSWORD, SALT);
String body = "{\"username\":\"" + USERNAME + "\",\"password\":\"" + codedPassword + "\"}";
try {
diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml
index d3d3d31..55a35f3 100644
--- a/ruoyi-admin/src/main/resources/logback.xml
+++ b/ruoyi-admin/src/main/resources/logback.xml
@@ -198,6 +198,18 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
+ <appender name="uav" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/uav.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!--鎸夊ぉ鍥炴粴daily-->
+ <fileNamePattern>${log.path}/uav.%d{yyyy-MM-dd}.log</fileNamePattern>
+ <!--鏃ュ織鏈�澶х殑鍘嗗彶60澶�-->
+ <maxHistory>60</maxHistory>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${log.pattern}</pattern>
+ </encoder>
+ </appender>
<!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 -->
<logger name="com.ruoyi" level="info"/>
<!-- Spring鏃ュ織绾у埆鎺у埗 -->
@@ -256,4 +268,7 @@
<logger name="cmd" level="DEBUG">
<appender-ref ref="cmd"/>
</logger>
+ <logger name="uav" level="DEBUG">
+ <appender-ref ref="uav"/>
+ </logger>
</configuration>
\ No newline at end of file
--
Gitblit v1.9.3