From 711fefa168d1239bbe2946d5e91dd4e895e84275 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sun, 3 Nov 2024 07:38:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=8D=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/impl/LogServiceImpl.java | 2 +- .../iot/vmp/vmanager/log/LogController.java | 4 +-- src/main/resources/logback-spring.xml | 27 +------------------ 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java index e23c8440..ed9db4c4 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java @@ -77,7 +77,7 @@ public class LogServiceImpl implements ILogService { } private File getLogDir() { - Logger logger = (Logger) LoggerFactory.getLogger("com.genersoft.iot.vmp"); + Logger logger = (Logger) LoggerFactory.getLogger("root"); RollingFileAppender rollingFileAppender = (RollingFileAppender) logger.getAppender("RollingFile"); File rollingFile = new File(rollingFileAppender.getFile()); return rollingFile.getParentFile(); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java index 640f2b4f..b0d02eae 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java @@ -69,8 +69,8 @@ public class LogController { * 下载指定日志文件 */ @ResponseBody - @GetMapping("/file") - public void downloadFile(HttpServletResponse response, @RequestParam(required = true) String fileName) { + @GetMapping("/file/{fileName}") + public void downloadFile(HttpServletResponse response, @PathVariable String fileName) { try { File file = logService.getFileByName(fileName); if (file == null || !file.exists() || !file.isFile()) { diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 585e1d67..308f148b 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -55,27 +55,6 @@ - - - - - - ${LOG_HOME}/error-%d{yyyy-MM-dd}.%i.log - - 30 - 20MB - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n - UTF-8 - - - - WARN - - - @@ -97,12 +76,8 @@ - - - - - +