Commit aefa5c7d authored by 赵啸非's avatar 赵啸非

异常日志添加

parent c01b2f57
...@@ -40,6 +40,20 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '异常日志-菜单管理-维 ...@@ -40,6 +40,20 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '异常日志-菜单管理-维
-- ---------------------------- -- ----------------------------
-- 异常日志参数 SQL -- 异常日志参数 SQL
-- ---------------------------- -- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'java', 'java', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'php', 'php', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'c#', 'c#', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'android', 'android', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'vue', 'vue', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'webos', 'webos', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'ios', 'ios', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '当前客户端使用平台', 'ErrorLog', 'platform', 'python', 'python', 1, 4, 0, 'platform', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '等级', 'ErrorLog', 'level', 'FATAL', 'FATAL', 1, 4, 0, 'level', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '等级', 'ErrorLog', 'level', 'ERROR', 'ERROR', 1, 4, 0, 'level', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '等级', 'ErrorLog', 'level', 'WARNING', 'WARNING', 1, 4, 0, 'level', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '等级', 'ErrorLog', 'level', 'INFO', 'INFO', 1, 4, 0, 'level', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '等级', 'ErrorLog', 'level', 'DEBUG', 'DEBUG', 1, 4, 0, 'level', NULL, NULL, NULL);
-- ---------------------------- -- ----------------------------
-- 平台用户操作日志业务菜单 SQL -- 平台用户操作日志业务菜单 SQL
-- ---------------------------- -- ----------------------------
......
...@@ -57,19 +57,28 @@ DROP TABLE IF EXISTS `mortals_xhx_error_log`; ...@@ -57,19 +57,28 @@ DROP TABLE IF EXISTS `mortals_xhx_error_log`;
CREATE TABLE mortals_xhx_error_log( CREATE TABLE mortals_xhx_error_log(
`id` bigint(20) COMMENT '主键ID', `id` bigint(20) COMMENT '主键ID',
`traceID` varchar(64) COMMENT '追踪Id', `traceID` varchar(64) COMMENT '追踪Id',
`serverType` varchar(64) COMMENT '服务类型,webOS,android,IOS,服务后端', `appName` varchar(64) COMMENT '应用名称,宿主客户端运行唯一标识。',
`appName` varchar(64) COMMENT '应用名称', `hostName` varchar(64) COMMENT '主机名',
`hostName` varchar(64) COMMENT '实例IP', `message` varchar(256) COMMENT '消息标识,如用户登录异常。',
`logLevel` varchar(64) COMMENT '日志等级', `platform` varchar(64) COMMENT '当前客户端使用平台(java,php,c#,android,vue,webos,ios,python)',
`culprit` varchar(512) COMMENT '主要导致异常函数或方法调用名称',
`tags` varchar(512) COMMENT '异常事件标记,多个逗号分隔。用以归集异常事件种类。',
`level` varchar(64) COMMENT '等级(FATAL,ERROR,WARNING,INFO,DEBUG)',
`environment` varchar(1024) COMMENT '客户端运行环境变量信息',
`releaseVersion` varchar(64) COMMENT '客户端运行版本信息',
`fingerprint` varchar(64) COMMENT '指纹标识,对于相同异常事件归集数量使用。',
`threadNo` varchar(64) COMMENT '线程号', `threadNo` varchar(64) COMMENT '线程号',
`error` text COMMENT '异常堆栈信息', `checkNum` int(4) COMMENT '针对同一个异常事件,数量加1',
`response` text COMMENT '响应结果', `errorStack` text COMMENT '异常堆栈信息',
`logTime` datetime COMMENT '日志产生时间', `context` text COMMENT '上下文信息,如js中发送异常事件,定位源码中信息。',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `extra` varchar(2048) COMMENT '扩展信息',
`logTime` datetime COMMENT '日志时间',
`createUserId` bigint(20) COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间', `createTime` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='异常日志'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='异常日志';
-- ---------------------------- -- ----------------------------
-- 平台用户操作日志业务表 -- 平台用户操作日志业务表
-- ---------------------------- -- ----------------------------
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
"vue-cropper": "0.5.5", "vue-cropper": "0.5.5",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vue2-org-tree": "^1.3.5", "vue2-org-tree": "^1.3.5",
"vuex": "3.6.0" "vuex": "3.6.0",
"highlight.js": "11.6.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "4.4.6", "@vue/cli-plugin-babel": "4.4.6",
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
"vue-cropper": "0.5.5", "vue-cropper": "0.5.5",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vue2-org-tree": "^1.3.5", "vue2-org-tree": "^1.3.5",
"vuex": "3.6.0" "vuex": "3.6.0",
"highlight.js": "11.6.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "4.4.6", "@vue/cli-plugin-babel": "4.4.6",
......
...@@ -4,22 +4,29 @@ ...@@ -4,22 +4,29 @@
:title="title" :title="title"
:visible.sync="open" :visible.sync="open"
:direction="direction" :direction="direction"
size="50%"> size="70%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="140px">
<el-row> <el-row>
<Field label="追踪Id" prop="traceID" v-model="form.traceID" placeholder="请输入追踪Id"/> <Field label="追踪Id" prop="traceID" v-model="form.traceID" placeholder="请输入追踪Id"/>
<Field label="服务类型,webOS,android,IOS,服务后端" prop="serverType" v-model="form.serverType" placeholder="请输入服务类型,webOS,android,IOS,服务后端"/> <Field label="应用名称" prop="appName" v-model="form.appName" placeholder="请输入应用名称,宿主客户端运行唯一标识。"/>
<Field label="应用名称" prop="appName" v-model="form.appName" placeholder="请输入应用名称"/> <Field label="主机名" prop="hostName" v-model="form.hostName" placeholder="请输入主机名"/>
<Field label="实例IP" prop="hostName" v-model="form.hostName" placeholder="请输入实例IP"/> <Field label="消息标识" prop="message" v-model="form.message" placeholder="请输入消息标识,如用户登录异常。"/>
<Field label="日志等级" prop="logLevel" v-model="form.logLevel" placeholder="请输入日志等级"/> <Field label="客户端使用平台" prop="platform" v-model="form.platform" type="select" :enumData="dict.platform" placeholder="请选择当前客户端使用平台"/>
<Field label="异常函数名" prop="culprit" v-model="form.culprit" placeholder="请输入主要导致异常函数或方法调用名称"/>
<Field label="异常事件标记。" prop="tags" v-model="form.tags" placeholder="请输入异常事件标记,多个逗号分隔。用以归集异常事件种类。"/>
<Field label="告警等级" prop="level" v-model="form.level" type="select" :enumData="dict.level" placeholder="请选择等级"/>
<Field label="环境变量信息" prop="environment" v-model="form.environment" placeholder="请输入客户端运行环境变量信息"/>
<Field label="版本信息" prop="releaseVersion" v-model="form.releaseVersion" placeholder="请输入客户端运行版本信息"/>
<Field label="指纹标识" prop="fingerprint" v-model="form.fingerprint" placeholder="请输入指纹标识,对于相同异常事件归集数量使用。"/>
<Field label="线程号" prop="threadNo" v-model="form.threadNo" placeholder="请输入线程号"/> <Field label="线程号" prop="threadNo" v-model="form.threadNo" placeholder="请输入线程号"/>
<Field label="异常堆栈信息" prop="error" v-model="form.error" type="textarea" placeholder="请输入异常堆栈信息"/> <Field label="异常事件数量" prop="checkNum" v-model="form.checkNum" placeholder="请输入针对同一个异常事件,数量加1"/>
<Field label="响应结果" prop="response" v-model="form.response" type="textarea" placeholder="请输入响应结果"/> <Field label="日志时间" prop="logTime" v-model="form.logTime" type="date" />
<Field label="日志产生时间" prop="logTime" v-model="form.logTime" type="date" /> <Field label="异常堆栈信息" :span="24" prop="errorStack" v-model="form.errorStack" rows="6" type="textarea" placeholder="请输入异常堆栈信息"/>
<Field label="上下文信息" :span="24" prop="context" v-model="form.context" type="textarea" placeholder="请输入上下文信息,如js中发送异常事件,定位源码中信息。"/>
<Field label="扩展信息" :span="24" prop="extra" v-model="form.extra" type="textarea" placeholder="请输入扩展信息"/>
</el-row>
<form-buttons @submit='submitForm' noCancelBtn /> </el-row>
</el-form> </el-form>
</el-drawer> </el-drawer>
...@@ -104,13 +111,21 @@ ...@@ -104,13 +111,21 @@
reset() { reset() {
this.form = { this.form = {
traceID : "", traceID : "",
serverType : "",
appName : "", appName : "",
hostName : "", hostName : "",
logLevel : "", message : "",
platform : "java",
culprit : "",
tags : "",
level : "",
environment : "",
releaseVersion : "",
fingerprint : "",
threadNo : "", threadNo : "",
error : "", checkNum : null,
response : "", errorStack : "",
context : "",
extra : "",
logTime : null, logTime : null,
}; };
this.resetForm("form"); this.resetForm("form");
......
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" notAdd notDel :config="tableConfig"> <LayoutTable notAdd notDel :data="tableData" :config="tableConfig">
</LayoutTable> </LayoutTable>
...@@ -43,47 +43,43 @@ ...@@ -43,47 +43,43 @@
{ {
name: "traceID", name: "traceID",
type: "text", type: "text",
label: "TraceID", label: "追踪Id",
fuzzy: true
},
{
name: "serverType",
type: "text",
label: "服务类型,webOS,android,IOS,服务后端",
fuzzy: true fuzzy: true
}, },
{ {
name: "appName", name: "appName",
type: "text", type: "text",
label: "应用名称", label: "应用名称,宿主客户端运行唯一标识。",
fuzzy: true
},
{
name: "logTime",
type: "date",
label: "日志产生时间",
fuzzy: true fuzzy: true
}, },
], ],
columns: [ columns: [
{type: "index",label: "序号",width: 50 ,align:"center"}, {type: "index",label: "序号",align:"center",width: 50},
{label: "TraceID", prop: "traceID"}, {label: "追踪Id", prop: "traceID"},
{label: "服务类型", prop: "serverType"},
{label: "应用名称", prop: "appName"}, {label: "应用名称", prop: "appName"},
{label: "线程号", prop: "threadNo"}, {label: "主机名", prop: "hostName"},
{label: "消息标识", prop: "message"},
{label: "当前客户端使用平台", prop: "platform",formatter:this.formatter},
{label: "异常事件标记", prop: "tags"},
{label: "警告等级", prop: "level",formatter: this.formatter},
{label: "异常事件数量", prop: "checkNum"},
{label: "日志产生时间", prop: "logTime", formatter: this.formatterDate}, {label: "日志时间", prop: "logTime", formatter: this.formatterDate},
{ {
label: "操作", label: "操作",
width: 240, width: 120,
formatter: row => { formatter: row => {
return ( return (
<table-buttons noAdd noDel noEdit row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} /> <table-buttons noAdd noEdit noDel row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
); );
} }
} }
......
...@@ -11,28 +11,52 @@ ...@@ -11,28 +11,52 @@
<el-descriptions-item label="追踪Id" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="追踪Id" label-class-name="labelClass" content-class-name="contentClass">
{{form.traceID}} {{form.traceID}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="服务类型,webOS,android,IOS,服务后端" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="应用名称,宿主客户端运行唯一标识。" label-class-name="labelClass" content-class-name="contentClass">
{{form.serverType}}
</el-descriptions-item>
<el-descriptions-item label="应用名称" label-class-name="labelClass" content-class-name="contentClass">
{{form.appName}} {{form.appName}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="实例IP" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="主机名" label-class-name="labelClass" content-class-name="contentClass">
{{form.hostName}} {{form.hostName}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="日志等级" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="消息标识,如用户登录异常。" label-class-name="labelClass" content-class-name="contentClass">
{{form.logLevel}} {{form.message}}
</el-descriptions-item>
<el-descriptions-item label="当前客户端使用平台" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("platform", form.platform) }}
</el-descriptions-item>
<el-descriptions-item label="主要导致异常函数或方法调用名称" label-class-name="labelClass" content-class-name="contentClass">
{{form.culprit}}
</el-descriptions-item>
<el-descriptions-item label="异常事件标记,多个逗号分隔。用以归集异常事件种类。" label-class-name="labelClass" content-class-name="contentClass">
{{form.tags}}
</el-descriptions-item>
<el-descriptions-item label="等级" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("level", form.level) }}
</el-descriptions-item>
<el-descriptions-item label="客户端运行环境变量信息" label-class-name="labelClass" content-class-name="contentClass">
{{form.environment}}
</el-descriptions-item>
<el-descriptions-item label="客户端运行版本信息" label-class-name="labelClass" content-class-name="contentClass">
{{form.releaseVersion}}
</el-descriptions-item>
<el-descriptions-item label="指纹标识,对于相同异常事件归集数量使用。" label-class-name="labelClass" content-class-name="contentClass">
{{form.fingerprint}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="线程号" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="线程号" label-class-name="labelClass" content-class-name="contentClass">
{{form.threadNo}} {{form.threadNo}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="针对同一个异常事件,数量加1" label-class-name="labelClass" content-class-name="contentClass">
{{form.checkNum}}
</el-descriptions-item>
<el-descriptions-item label="异常堆栈信息" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="异常堆栈信息" label-class-name="labelClass" content-class-name="contentClass">
{{form.error}} {{form.errorStack}}
</el-descriptions-item>
<el-descriptions-item label="上下文信息,如js中发送异常事件,定位源码中信息。" label-class-name="labelClass" content-class-name="contentClass">
{{form.context}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="响应结果" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="扩展信息" label-class-name="labelClass" content-class-name="contentClass">
{{form.response}} {{form.extra}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="日志产生时间" label-class-name="labelClass" content-class-name="contentClass"> <el-descriptions-item label="日志时间" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatterDate(form.logTime)}} {{ util_formatterDate(form.logTime)}}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
......
...@@ -4959,6 +4959,11 @@ hex-color-regex@^1.1.0: ...@@ -4959,6 +4959,11 @@ hex-color-regex@^1.1.0:
resolved "https://registry.nlark.com/hex-color-regex/download/hex-color-regex-1.1.0.tgz" resolved "https://registry.nlark.com/hex-color-regex/download/hex-color-regex-1.1.0.tgz"
integrity sha1-TAb8y0YC/iYCs8k9+C1+fb8aio4= integrity sha1-TAb8y0YC/iYCs8k9+C1+fb8aio4=
highlight.js@11.6.0:
version "11.6.0"
resolved "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.6.0.tgz#a50e9da05763f1bb0c1322c8f4f755242cff3f5a"
integrity sha512-ig1eqDzJaB0pqEvlPVIpSSyMaO92bH1N2rJpLMN/nX396wTpDA4Eq0uK+7I/2XG17pFaaKE0kjV/XPeGt7Evjw==
highlight.js@^10.7.1: highlight.js@^10.7.1:
version "10.7.3" version "10.7.3"
resolved "https://registry.nlark.com/highlight.js/download/highlight.js-10.7.3.tgz" resolved "https://registry.nlark.com/highlight.js/download/highlight.js-10.7.3.tgz"
......
...@@ -23,7 +23,7 @@ import java.io.IOException; ...@@ -23,7 +23,7 @@ import java.io.IOException;
* @author: zxfei * @author: zxfei
* @date: 2022/4/20 14:52 * @date: 2022/4/20 14:52
*/ */
@Component //@Component
@Slf4j @Slf4j
public class RequestFilter extends OncePerRequestFilter implements Filter { public class RequestFilter extends OncePerRequestFilter implements Filter {
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 等级(FATAL,ERROR,WARNING,INFO,DEBUG)枚举类
*
* @author zxfei
*/
public enum LevelEnum {
FATAL("FATAL", "FATAL"),
ERROR("ERROR", "ERROR"),
WARNING("WARNING", "WARNING"),
INFO("INFO", "INFO"),
DEBUG("DEBUG", "DEBUG");
private String value;
private String desc;
LevelEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static LevelEnum getByValue(String value) {
for (LevelEnum levelEnum : LevelEnum.values()) {
if (levelEnum.getValue() == value) {
return levelEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (LevelEnum item : LevelEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 当前客户端使用平台(java,php,c#,android,vue,webos,ios,python)枚举类
*
* @author zxfei
*/
public enum PlatformEnum {
java("java", "java"),
php("php", "php"),
c("c#", "c#"),
android("android", "android"),
vue("vue", "vue"),
webos("webos", "webos"),
ios("ios", "ios"),
python("python", "python");
private String value;
private String desc;
PlatformEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static PlatformEnum getByValue(String value) {
for (PlatformEnum platformEnum : PlatformEnum.values()) {
if (platformEnum.getValue() == value) {
return platformEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (PlatformEnum item : PlatformEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -29,8 +29,6 @@ public class AccessLogServiceImpl extends AbstractCRUDServiceImpl<AccessLogDao, ...@@ -29,8 +29,6 @@ public class AccessLogServiceImpl extends AbstractCRUDServiceImpl<AccessLogDao,
accessLogEntity.setCreateTime(new Date(generateDateTime)); accessLogEntity.setCreateTime(new Date(generateDateTime));
return this.getDao().get(key,accessLogEntity); return this.getDao().get(key,accessLogEntity);
//return super.get(key, context);
} }
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -8,8 +8,9 @@ import java.util.List; ...@@ -8,8 +8,9 @@ import java.util.List;
* 异常日志 DAO接口 * 异常日志 DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-08-17 * @date 2022-08-24
*/ */
public interface ErrorLogDao extends ICRUDSubmeterDao<ErrorLogEntity,Long>{ public interface ErrorLogDao extends ICRUDSubmeterDao<ErrorLogEntity,Long>{
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
* 异常日志DaoImpl DAO接口 * 异常日志DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-08-17 * @date 2022-08-24
*/ */
@Repository("errorLogDao") @Repository("errorLogDao")
public class ErrorLogDaoImpl extends SubmeterDaoImpl<ErrorLogEntity,Long> implements ErrorLogDao { public class ErrorLogDaoImpl extends SubmeterDaoImpl<ErrorLogEntity,Long> implements ErrorLogDao {
...@@ -48,6 +48,4 @@ public class ErrorLogDaoImpl extends SubmeterDaoImpl<ErrorLogEntity,Long> implem ...@@ -48,6 +48,4 @@ public class ErrorLogDaoImpl extends SubmeterDaoImpl<ErrorLogEntity,Long> implem
} }
...@@ -7,7 +7,7 @@ import java.util.List; ...@@ -7,7 +7,7 @@ import java.util.List;
* 异常日志视图对象 * 异常日志视图对象
* *
* @author zxfei * @author zxfei
* @date 2022-08-17 * @date 2022-08-24
*/ */
public class ErrorLogVo extends BaseEntityLong { public class ErrorLogVo extends BaseEntityLong {
......
...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.error.model.ErrorLogEntity; ...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.error.model.ErrorLogEntity;
* 异常日志 service接口 * 异常日志 service接口
* *
* @author zxfei * @author zxfei
* @date 2022-08-17 * @date 2022-08-24
*/ */
public interface ErrorLogService extends ICRUDService<ErrorLogEntity,Long>{ public interface ErrorLogService extends ICRUDService<ErrorLogEntity,Long>{
......
package com.mortals.xhx.module.error.service.impl; package com.mortals.xhx.module.error.service.impl;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil; import com.mortals.xhx.module.access.model.AccessLogEntity;
import com.mortals.xhx.module.biz.model.BizLogEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -9,18 +9,34 @@ import com.mortals.framework.model.Context; ...@@ -9,18 +9,34 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.error.dao.ErrorLogDao; import com.mortals.xhx.module.error.dao.ErrorLogDao;
import com.mortals.xhx.module.error.model.ErrorLogEntity; import com.mortals.xhx.module.error.model.ErrorLogEntity;
import com.mortals.xhx.module.error.service.ErrorLogService; import com.mortals.xhx.module.error.service.ErrorLogService;
import cn.hutool.core.util.IdUtil;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* ErrorLogService * ErrorLogService
* 异常日志 service实现 * 异常日志 service实现
* *
* @author zxfei * @author zxfei
* @date 2022-08-17 * @date 2022-08-24
*/ */
@Service("errorLogService") @Service("errorLogService")
public class ErrorLogServiceImpl extends AbstractCRUDServiceImpl<ErrorLogDao, ErrorLogEntity, Long> implements ErrorLogService { public class ErrorLogServiceImpl extends AbstractCRUDServiceImpl<ErrorLogDao, ErrorLogEntity, Long> implements ErrorLogService {
@Override
protected void saveBefore(ErrorLogEntity entity, Context context) throws AppException {
//非系统自增,需这里设置主键
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
super.saveBefore(entity, context);
}
@Override
public int save(List<ErrorLogEntity> list, Context context) throws AppException {
list.forEach(item->{
item.setId(IdUtil.getSnowflake(0, 1).nextId());
});
return super.save(list, context);
}
@Override @Override
public ErrorLogEntity get(Long key, Context context) throws AppException { public ErrorLogEntity get(Long key, Context context) throws AppException {
......
...@@ -27,7 +27,7 @@ import static com.mortals.framework.ap.SysConstains.*; ...@@ -27,7 +27,7 @@ import static com.mortals.framework.ap.SysConstains.*;
* 异常日志 * 异常日志
* *
* @author zxfei * @author zxfei
* @date 2022-08-17 * @date 2022-08-24
*/ */
@RestController @RestController
@RequestMapping("error/log") @RequestMapping("error/log")
...@@ -42,16 +42,16 @@ public class ErrorLogController extends BaseCRUDJsonBodyMappingController<ErrorL ...@@ -42,16 +42,16 @@ public class ErrorLogController extends BaseCRUDJsonBodyMappingController<ErrorL
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "platform", paramService.getParamBySecondOrganize("ErrorLog","platform"));
this.addDict(model, "level", paramService.getParamBySecondOrganize("ErrorLog","level"));
super.init(model, context); super.init(model, context);
} }
@Override @Override
protected void doListBefore(ErrorLogEntity query, Map<String, Object> model, Context context) throws AppException { protected void doListBefore(ErrorLogEntity query, Map<String, Object> model, Context context) throws AppException {
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING)); orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING));
query.setOrderColList(orderColList); query.setOrderColList(orderColList);
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
} }
\ No newline at end of file
...@@ -19,10 +19,9 @@ Authorization: {{authToken}} ...@@ -19,10 +19,9 @@ Authorization: {{authToken}}
Content-Type: application/json Content-Type: application/json
{ {
"traceID":"arvhdl", "traceID":"p90qpk",
"serverType":"nqq0bh", "appName":"dp7dhc",
"appName":"8i6fqg", "message":"073hnq",
"logTime":"1660665600000",
"page":1, "page":1,
"size":10 "size":10
} }
...@@ -34,15 +33,23 @@ Authorization: {{authToken}} ...@@ -34,15 +33,23 @@ Authorization: {{authToken}}
Content-Type: application/json Content-Type: application/json
{ {
"traceID":"8ryjdp", "traceID":"mbto1z",
"serverType":"mdgdb8", "appName":"6lcsoy",
"appName":"6fobjf", "hostName":"ul06eq",
"hostName":"mpwzb3", "message":"8kau4i",
"logLevel":"of3igm", "platform":"java",
"threadNo":"eqdsam", "culprit":"8r6wce",
"error":"asd235", "tags":"sw7jp2",
"response":"2djxe2", "level":"INFO",
"logTime":"1660665600000", "environment":"ayr3ua",
"releaseVersion":"chxwkw",
"fingerprint":"2txnit",
"threadNo":"2z9vq4",
"checkNum":1,
"errorStack":"z3yxnh",
"context":"az7aus",
"extra":"9c0pnj",
"logTime":"1661270400000"
} }
> {% > {%
......
{ {
"local": { "local": {
"baseUrl": "http://127.0.0.1:18222/m", "baseUrl": "http://127.0.0.1:18225/logservice",
"baseLogin": "http://127.0.0.1:18222/m" "baseLogin": "http://127.0.0.1:18222/logservice"
}, },
"dev": { "dev": {
"baseUrl": "http://192.168.0.217:18222/m", "baseUrl": "http://192.168.0.217:18222/logservice",
"baseLogin": "http://192.168.0.98:11078/base" "baseLogin": "http://192.168.0.98:11078/logservice"
}, },
"test": { "test": {
"baseUrl": "http://192.168.0.98:11091/m", "baseUrl": "http://192.168.0.98:11078/logservice",
"baseLogin": "http://192.168.0.98:11078/base" "baseLogin": "http://192.168.0.98:11078/zwfw"
}, },
"portal": { "portal": {
"baseUrl": "http://192.168.0.98:11072/zwfw", "baseUrl": "http://192.168.0.98:11072/zwfw",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment