监控接口 日志接口 上传接口 配置接口
This commit is contained in:
parent
7ca0904698
commit
0c20c5ec96
|
|
@ -1,16 +1,19 @@
|
||||||
package com.hxkj.admin.controller;
|
package com.hxkj.admin.controller;
|
||||||
|
|
||||||
import com.hxkj.admin.service.IIndexService;
|
import com.hxkj.admin.service.IIndexService;
|
||||||
|
import com.hxkj.common.core.AjaxResult;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页管理
|
* 主页管理
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/index")
|
@RequestMapping("/api/index")
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
@ -26,8 +29,8 @@ public class IndexController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/console")
|
@GetMapping("/console")
|
||||||
public Object console() {
|
public Object console() {
|
||||||
iIndexService.console();
|
Map<String, Object> map = iIndexService.console();
|
||||||
return null;
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
package com.hxkj.admin.service;
|
package com.hxkj.admin.service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页服务类
|
* 主页服务类
|
||||||
*/
|
*/
|
||||||
public interface IIndexService {
|
public interface IIndexService {
|
||||||
|
|
||||||
void console();
|
/**
|
||||||
|
* 控制台数据
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> console();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,21 @@ import com.hxkj.admin.service.IIndexService;
|
||||||
import com.hxkj.common.utils.TimeUtil;
|
import com.hxkj.common.utils.TimeUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class IIndexServiceImpl implements IIndexService {
|
public class IIndexServiceImpl implements IIndexService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制台数据
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void console() {
|
public Map<String, Object> console() {
|
||||||
Map<String, Object> console = new LinkedHashMap<>();
|
Map<String, Object> console = new LinkedHashMap<>();
|
||||||
|
|
||||||
// 账号信息
|
// 账号信息
|
||||||
|
|
@ -32,8 +39,11 @@ public class IIndexServiceImpl implements IIndexService {
|
||||||
|
|
||||||
// 访客图表
|
// 访客图表
|
||||||
Map<String, Object> visitor = new LinkedHashMap<>();
|
Map<String, Object> visitor = new LinkedHashMap<>();
|
||||||
System.out.println(TimeUtil.daysAgoTime(8));
|
visitor.put("date", TimeUtil.daysAgoDate(8));
|
||||||
|
visitor.put("list", new ArrayList<>());
|
||||||
|
console.put("visitor", visitor);
|
||||||
|
|
||||||
|
return console;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- 日志级别排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
|
||||||
|
<configuration monitorInterval="5">
|
||||||
|
|
||||||
|
<!-- 变量配置 -->
|
||||||
|
<Properties>
|
||||||
|
<property name="LOG_PATTERN" value="%date{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" />
|
||||||
|
<property name="FILE_PATH" value="/www/wwwroot/logs/like-admin" />
|
||||||
|
<property name="FILE_NAME" value="admin-log4j2" />
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<appenders>
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<console name="Console" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</console>
|
||||||
|
|
||||||
|
<!-- 临时测试日志 -->
|
||||||
|
<File name="Filelog" fileName="${FILE_PATH}/test.log" append="false">
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
</File>
|
||||||
|
|
||||||
|
<!-- Info日志分割压缩 -->
|
||||||
|
<RollingFile name="RollingFileInfo" fileName="${FILE_PATH}/info.log" filePattern="${FILE_PATH}/${FILE_NAME}-INFO-%d{yyyy-MM-dd}_%i.log.gz">
|
||||||
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy interval="1"/>
|
||||||
|
<SizeBasedTriggeringPolicy size="10MB"/>
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy max="15"/>
|
||||||
|
</RollingFile>
|
||||||
|
|
||||||
|
<!-- warn日志分割压缩 -->
|
||||||
|
<RollingFile name="RollingFileWarn" fileName="${FILE_PATH}/warn.log" filePattern="${FILE_PATH}/${FILE_NAME}-WARN-%d{yyyy-MM-dd}_%i.log.gz">
|
||||||
|
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy interval="1"/>
|
||||||
|
<SizeBasedTriggeringPolicy size="10MB"/>
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy max="15"/>
|
||||||
|
</RollingFile>
|
||||||
|
|
||||||
|
<!-- error日志分割压缩 -->
|
||||||
|
<RollingFile name="RollingFileError" fileName="${FILE_PATH}/error.log" filePattern="${FILE_PATH}/${FILE_NAME}-ERROR-%d{yyyy-MM-dd}_%i.log.gz">
|
||||||
|
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy interval="1"/>
|
||||||
|
<SizeBasedTriggeringPolicy size="10MB"/>
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy max="15"/>
|
||||||
|
</RollingFile>
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<loggers>
|
||||||
|
<!-- 过滤指定DEBUG信息 -->
|
||||||
|
<logger name="org.mybatis" level="info" additivity="false">
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- 监控系统信息 -->
|
||||||
|
<Logger name="org.springframework" level="info" additivity="false">
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</Logger>
|
||||||
|
|
||||||
|
<!-- 初始化日志 -->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="Console"/>
|
||||||
|
<appender-ref ref="Filelog"/>
|
||||||
|
<appender-ref ref="RollingFileInfo"/>
|
||||||
|
<appender-ref ref="RollingFileWarn"/>
|
||||||
|
<appender-ref ref="RollingFileError"/>
|
||||||
|
</root>
|
||||||
|
</loggers>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
@ -31,6 +31,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<!--log4j2依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Aop依赖 -->
|
<!-- Aop依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
1
pom.xml
1
pom.xml
|
|
@ -22,6 +22,7 @@
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
<log4j2.version>2.16.0</log4j2.version>
|
||||||
<mysql-connector.version>5.1.49</mysql-connector.version>
|
<mysql-connector.version>5.1.49</mysql-connector.version>
|
||||||
<mybatis-plus.version>3.4.3.1</mybatis-plus.version>
|
<mybatis-plus.version>3.4.3.1</mybatis-plus.version>
|
||||||
<mybatis-plus-join.version>1.2.2</mybatis-plus-join.version>
|
<mybatis-plus-join.version>1.2.2</mybatis-plus-join.version>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue