Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
3b48a1d6
Commit
3b48a1d6
authored
Mar 10, 2025
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复异常提醒,从而正确的跟踪异常信息
parent
557d5ee1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
141 deletions
+128
-141
AspectLogResult.java
...db/src/main/java/com/yanzuoguang/log/AspectLogResult.java
+2
-0
AspectLogStart.java
...-db/src/main/java/com/yanzuoguang/log/AspectLogStart.java
+5
-6
LogInfoVo.java
yzg-util-db/src/main/java/com/yanzuoguang/log/LogInfoVo.java
+120
-1
LogLocal.java
yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java
+1
-1
LogVo.java
yzg-util-db/src/main/java/com/yanzuoguang/log/LogVo.java
+0
-133
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/log/AspectLogResult.java
View file @
3b48a1d6
...
@@ -75,6 +75,8 @@ public class AspectLogResult {
...
@@ -75,6 +75,8 @@ public class AspectLogResult {
}
else
{
}
else
{
responseResult
=
responseDefault
;
responseResult
=
responseDefault
;
}
}
String
fullUrl
=
String
.
format
(
"%s:%s"
,
tag
,
url
);
logCountTime
.
start
(
fullUrl
);
String
json
=
JsonHelper
.
serialize
(
responseResult
);
String
json
=
JsonHelper
.
serialize
(
responseResult
);
Log
.
error
(
cls
,
resultEx
,
"%s [ %s ] time %d ms, result: %s"
,
tag
,
url
,
time
,
aspectLogBody
.
getMaxString
(
json
));
Log
.
error
(
cls
,
resultEx
,
"%s [ %s ] time %d ms, result: %s"
,
tag
,
url
,
time
,
aspectLogBody
.
getMaxString
(
json
));
...
...
yzg-util-db/src/main/java/com/yanzuoguang/log/AspectLogStart.java
View file @
3b48a1d6
...
@@ -63,16 +63,15 @@ public class AspectLogStart {
...
@@ -63,16 +63,15 @@ public class AspectLogStart {
LogInfoVo
log
=
new
LogInfoVo
();
LogInfoVo
log
=
new
LogInfoVo
();
log
.
setCreateDate
(
DateHelper
.
getDateTimeString
(
new
Date
()));
log
.
setCreateDate
(
DateHelper
.
getDateTimeString
(
new
Date
()));
// 写入其他对象
// 写入其他对象
log
.
setActionKey
(
tag
);
log
.
setApplicationName
(
this
.
cloudConfig
.
getApplicationName
());
log
.
setActionSubKey
(
String
.
format
(
"%s:%s"
,
this
.
cloudConfig
.
getApplicationName
(),
url
));
log
.
setTag
(
tag
);
log
.
setUrl
(
url
);
log
.
setContent
(
body
);
log
.
setContent
(
body
);
// 生命日志对象爱嗯
// 生命日志对象爱嗯
log
.
setLogId
(
StringHelper
.
getNewID
());
log
.
setLogId
(
StringHelper
.
getNewID
());
// 开始记录到日志对象中
this
.
logLocal
.
startLog
(
log
);
this
.
logLocal
.
startLog
(
log
);
String
fullUrl
=
String
.
format
(
"%s:%s"
,
tag
,
url
);
// 输出日志
logCountTime
.
start
(
fullUrl
);
boolean
isLog
=
logFlag
&&
this
.
cloudConfig
.
isLogCommon
();
boolean
isLog
=
logFlag
&&
this
.
cloudConfig
.
isLogCommon
();
if
(
isLog
)
{
if
(
isLog
)
{
Log
.
info
(
cls
,
" %s [ %s ] request: %s"
,
tag
,
url
,
body
);
Log
.
info
(
cls
,
" %s [ %s ] request: %s"
,
tag
,
url
,
body
);
...
...
yzg-util-db/src/main/java/com/yanzuoguang/log/LogInfoVo.java
View file @
3b48a1d6
package
com
.
yanzuoguang
.
log
;
package
com
.
yanzuoguang
.
log
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
LogInfoVo
extends
LogVo
{
public
class
LogInfoVo
extends
BaseVo
{
private
static
final
long
serialVersionUID
=
-
8629960247077620458L
;
/**
* 日志id
*/
@ApiModelProperty
(
value
=
"日志Id"
,
required
=
true
,
example
=
"{{$uuid}}"
)
private
String
logId
;
/**
* 项目名称
*/
@ApiModelProperty
(
value
=
"项目名称"
,
required
=
true
)
private
String
applicationName
;
/**
* 触发点
*/
@ApiModelProperty
(
value
=
"触发点"
,
required
=
true
,
example
=
"MQ|WEB|FEIGN"
)
private
String
tag
;
/**
* 请求接口地址
*/
@ApiModelProperty
(
value
=
"接口地址"
,
required
=
true
,
example
=
"tbd-order/order/save"
)
private
String
url
;
/**
* 请求内容
*/
@ApiModelProperty
(
value
=
"请求内容"
,
required
=
true
,
example
=
"{}"
)
private
String
content
;
/**
* 返回参数
*/
@ApiModelProperty
(
value
=
"返回结果"
,
required
=
true
,
example
=
"{}"
)
private
String
result
;
/**
* 接口处理状态,是否有异常
*/
@ApiModelProperty
(
value
=
"执行状态"
,
notes
=
"0表示成功,其他状态表示失败,-1表示执行中"
,
required
=
true
,
example
=
"0"
)
private
int
status
;
/**
/**
* 开始时间
* 开始时间
*/
*/
@ApiModelProperty
(
value
=
"开始时间"
,
notes
=
"单位(毫秒)"
)
@ApiModelProperty
(
value
=
"开始时间"
,
notes
=
"单位(毫秒)"
)
private
long
start
=
System
.
currentTimeMillis
();
private
long
start
=
System
.
currentTimeMillis
();
/**
* 使用时间
*/
@ApiModelProperty
(
value
=
"执行耗时"
,
notes
=
"单位(毫秒)"
,
required
=
true
,
example
=
"20"
)
private
int
useTime
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
notes
=
"单位(毫秒)"
,
required
=
false
,
example
=
"1987-11-24 23:15:18"
)
private
String
createDate
;
public
String
getLogId
()
{
return
logId
;
}
public
void
setLogId
(
String
logId
)
{
this
.
logId
=
logId
;
}
public
String
getApplicationName
()
{
return
applicationName
;
}
public
void
setApplicationName
(
String
applicationName
)
{
this
.
applicationName
=
applicationName
;
}
public
String
getTag
()
{
return
tag
;
}
public
void
setTag
(
String
tag
)
{
this
.
tag
=
tag
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
long
getStart
()
{
public
long
getStart
()
{
return
start
;
return
start
;
...
@@ -16,4 +119,20 @@ public class LogInfoVo extends LogVo {
...
@@ -16,4 +119,20 @@ public class LogInfoVo extends LogVo {
public
void
setStart
(
long
start
)
{
public
void
setStart
(
long
start
)
{
this
.
start
=
start
;
this
.
start
=
start
;
}
}
public
int
getUseTime
()
{
return
useTime
;
}
public
void
setUseTime
(
int
useTime
)
{
this
.
useTime
=
useTime
;
}
public
String
getCreateDate
()
{
return
createDate
;
}
public
void
setCreateDate
(
String
createDate
)
{
this
.
createDate
=
createDate
;
}
}
}
yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java
View file @
3b48a1d6
...
@@ -74,7 +74,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
...
@@ -74,7 +74,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
return
;
return
;
}
}
// 日志请求不记录,防止死循环递归
// 日志请求不记录,防止死循环递归
boolean
isLog
=
isLog
(
log
.
get
ActionKey
(),
log
.
getActionSubKey
());
boolean
isLog
=
isLog
(
log
.
get
Tag
(),
log
.
getUrl
());
if
(
isLog
)
{
if
(
isLog
)
{
this
.
remove
(
log
);
this
.
remove
(
log
);
}
else
{
}
else
{
...
...
yzg-util-db/src/main/java/com/yanzuoguang/log/LogVo.java
deleted
100644 → 0
View file @
557d5ee1
package
com
.
yanzuoguang
.
log
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* 日志实例
*
* @author 颜佐光
*/
@ApiModel
(
value
=
"日志对象"
)
public
class
LogVo
extends
BaseVo
{
private
static
final
long
serialVersionUID
=
-
8629960247077620458L
;
/**
* 日志id
*/
@ApiModelProperty
(
value
=
"日志Id"
,
required
=
true
,
example
=
"{{$uuid}}"
)
private
String
logId
;
/**
* 工程实例名
*/
@ApiModelProperty
(
value
=
"项目名称"
,
required
=
true
,
example
=
"MQ|WEB|FEIGN"
)
private
String
actionKey
;
/**
* 请求接口地址
*/
@ApiModelProperty
(
value
=
"接口地址"
,
required
=
true
,
example
=
"tbd-order/order/save"
)
private
String
actionSubKey
;
/**
* 请求内容
*/
@ApiModelProperty
(
value
=
"请求内容"
,
required
=
true
,
example
=
"{}"
)
private
String
content
;
/**
* 执行后的请求内容
*/
@ApiModelProperty
(
value
=
"执行后的请求内容,仅仅在内容有变化时写入"
,
required
=
true
,
example
=
"{}"
)
private
String
contentTo
;
/**
* 返回参数
*/
@ApiModelProperty
(
value
=
"返回结果"
,
required
=
true
,
example
=
"{}"
)
private
String
result
;
/**
* 接口处理状态,是否有异常
*/
@ApiModelProperty
(
value
=
"执行状态"
,
notes
=
"0表示成功,其他状态表示失败,-1表示执行中"
,
required
=
true
,
example
=
"0"
)
private
String
status
;
/**
* 使用时间
*/
@ApiModelProperty
(
value
=
"执行耗时"
,
notes
=
"单位(毫秒)"
,
required
=
true
,
example
=
"20"
)
private
int
useTime
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
notes
=
"单位(毫秒)"
,
required
=
false
,
example
=
"1987-11-24 23:15:18"
)
private
String
createDate
;
public
String
getLogId
()
{
return
logId
;
}
public
void
setLogId
(
String
logId
)
{
this
.
logId
=
logId
;
}
public
String
getActionKey
()
{
return
actionKey
;
}
public
void
setActionKey
(
String
actionKey
)
{
this
.
actionKey
=
actionKey
;
}
public
String
getActionSubKey
()
{
return
actionSubKey
;
}
public
void
setActionSubKey
(
String
actionSubKey
)
{
this
.
actionSubKey
=
actionSubKey
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getContentTo
()
{
return
contentTo
;
}
public
void
setContentTo
(
String
contentTo
)
{
this
.
contentTo
=
contentTo
;
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
int
getUseTime
()
{
return
useTime
;
}
public
void
setUseTime
(
int
useTime
)
{
this
.
useTime
=
useTime
;
}
public
String
getCreateDate
()
{
return
createDate
;
}
public
void
setCreateDate
(
String
createDate
)
{
this
.
createDate
=
createDate
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment