Commit 0188c6e41635914ad4a35443be175845cd9a253d

Authored by lector
1 parent 72b465ae

增加本地日志显示功能-增强yml配置

src/main/java/com/huaheng/pc/monitor/systemLog/controller/SystemLogController.java
@@ -2,6 +2,7 @@ package com.huaheng.pc.monitor.systemLog.controller; @@ -2,6 +2,7 @@ package com.huaheng.pc.monitor.systemLog.controller;
2 2
3 import com.huaheng.common.exception.service.ServiceException; 3 import com.huaheng.common.exception.service.ServiceException;
4 import org.apache.shiro.authz.annotation.RequiresPermissions; 4 import org.apache.shiro.authz.annotation.RequiresPermissions;
  5 +import org.springframework.beans.factory.annotation.Value;
5 import org.springframework.stereotype.Controller; 6 import org.springframework.stereotype.Controller;
6 import org.springframework.ui.ModelMap; 7 import org.springframework.ui.ModelMap;
7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.GetMapping;
@@ -12,12 +13,21 @@ import java.io.*; @@ -12,12 +13,21 @@ import java.io.*;
12 @Controller 13 @Controller
13 @RequestMapping("/monitor/systemLog") 14 @RequestMapping("/monitor/systemLog")
14 public class SystemLogController { 15 public class SystemLogController {
15 - private final String path = "D:\\company\\wms2\\WMSlog\\"; 16 +
  17 + /**
  18 + * 此处值应为日志所在路径
  19 + */
  20 +// @Value("${log.path}")
  21 +// private String path;
  22 + private String path = "D:\\company\\wms2\\WMSlog";
16 private String prefix = "monitor/systemLog"; 23 private String prefix = "monitor/systemLog";
17 24
  25 +
18 @RequiresPermissions("monitor:systemLog:view") 26 @RequiresPermissions("monitor:systemLog:view")
19 @GetMapping("") 27 @GetMapping("")
20 public String systemLog(ModelMap mmap){ 28 public String systemLog(ModelMap mmap){
  29 + path = path + "\\";
  30 + System.out.println("path路径为---"+path+"-----");
21 File info = new File(path+"sys-info"); 31 File info = new File(path+"sys-info");
22 File debug = new File(path+"sys-debug"); 32 File debug = new File(path+"sys-debug");
23 File warn = new File(path+"sys-warn"); 33 File warn = new File(path+"sys-warn");
src/main/resources/application.yml
@@ -189,3 +189,6 @@ gen: @@ -189,3 +189,6 @@ gen:
189 autoRemovePre: false 189 autoRemovePre: false
190 # 表前缀(类名不会包含表前缀) 190 # 表前缀(类名不会包含表前缀)
191 gen.tablePrefix: sys_ 191 gen.tablePrefix: sys_
  192 +#系统日志地址
  193 +log:
  194 + path: D:\home