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
77fb7cbb
Commit
77fb7cbb
authored
Mar 10, 2025
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复异常提醒,从而正确的跟踪异常信息
parent
899c303a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
33 deletions
+13
-33
AspectLogResult.java
...db/src/main/java/com/yanzuoguang/log/AspectLogResult.java
+9
-8
LogCountTime.java
...il-db/src/main/java/com/yanzuoguang/log/LogCountTime.java
+0
-1
LogLocal.java
yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java
+4
-24
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/log/AspectLogResult.java
View file @
77fb7cbb
...
...
@@ -41,11 +41,6 @@ public class AspectLogResult {
return
;
}
try
{
ResponseResult
<?>
responseResult
=
getJson
(
resultFrom
,
resultEx
);
String
json
=
JsonHelper
.
serialize
(
responseResult
);
String
result
=
logString
.
getMaxString
(
json
);
log
.
setResult
(
result
);
log
.
setEnd
(
System
.
currentTimeMillis
());
long
useTime
=
log
.
getEnd
()
-
log
.
getStart
();
log
.
setUseTime
((
int
)
useTime
);
...
...
@@ -54,8 +49,12 @@ public class AspectLogResult {
}
else
{
log
.
setStatus
(
LogInfoVo
.
STATUS_OK
);
}
// 输出请求结果
logLocal
.
result
(
log
);
ResponseResult
<?>
responseResult
=
getJson
(
resultFrom
,
resultEx
);
String
json
=
JsonHelper
.
serialize
(
responseResult
);
String
result
=
logString
.
getMaxString
(
json
);
log
.
setResult
(
result
);
// 输出日志标记
boolean
isLogCommon
=
log
.
isLogFlag
()
&&
this
.
cloudConfig
.
isLogCommon
();
boolean
isError
=
resultEx
!=
null
;
...
...
@@ -66,7 +65,9 @@ public class AspectLogResult {
}
catch
(
Exception
e
)
{
ExceptionHelper
.
PrintError
(
AspectLogResult
.
class
,
e
);
}
finally
{
logLocal
.
remove
(
log
);
// 输出请求结果
logLocal
.
result
(
log
);
if
(
log
.
isLogFlag
())
{
Log
.
threadCommit
();
}
...
...
yzg-util-db/src/main/java/com/yanzuoguang/log/LogCountTime.java
View file @
77fb7cbb
...
...
@@ -48,7 +48,6 @@ public class LogCountTime {
}
}
}
}
/**
...
...
yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java
View file @
77fb7cbb
...
...
@@ -40,10 +40,11 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
*/
protected
volatile
MemoryCache
<
Timeout
<
LogInfoVo
>>
cache
=
new
MemoryCache
<>(
CLEAR_CACHE
);
public
LogLocal
(
LogBase
logBase
,
CloudConfig
cloudConfig
,
List
<
LogFilter
>
logFilters
)
{
public
LogLocal
(
LogBase
logBase
,
CloudConfig
cloudConfig
,
List
<
LogFilter
>
logFilters
,
LogCountTime
logCountTime
)
{
this
.
logBase
=
logBase
;
this
.
cloudConfig
=
cloudConfig
;
this
.
logFilters
=
logFilters
;
this
.
logCountTime
=
logCountTime
;
}
@Override
...
...
@@ -73,12 +74,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
}
// 日志请求不记录,防止死循环递归
boolean
isLog
=
isLog
(
log
.
getTag
(),
log
.
getUrl
());
if
(
isLog
)
{
this
.
remove
(
log
);
}
else
{
this
.
resultWrite
(
log
);
}
this
.
resultWrite
(
log
);
String
fullUrl
=
String
.
format
(
"%s:%s"
,
tag
,
url
);
logCountTime
.
start
(
fullUrl
);
...
...
@@ -89,14 +85,6 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
long
time
=
System
.
currentTimeMillis
()
-
log
.
getStart
();
// 记录请求时间
logCountTime
.
finish
(
fullUrl
,
time
,
isError
);
}
/**
* 写入状态
*
* @param log 日志对象
*/
private
void
resultWrite
(
LogInfoVo
log
)
{
if
(
log
==
null
||
StringHelper
.
isEmpty
(
log
.
getLogId
()))
{
return
;
}
...
...
@@ -114,14 +102,6 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
}
}
/**
* 删除请求信息
*
* @param log 删除日志
*/
public
void
remove
(
LogInfoVo
log
)
{
this
.
resultWrite
(
log
,
StringHelper
.
EMPTY
,
StringHelper
.
EMPTY
,
false
);
}
/**
* 是否属于日志服务
...
...
@@ -160,7 +140,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
}
// 判断是否达到超时时间
if
(
timeout
.
isMaxTime
(
this
.
cloudConfig
.
getLogTimeMax
(),
this
.
cloudConfig
.
getLogTimeSplit
()))
{
this
.
result
Write
(
timeout
.
getData
(),
MAX_TIME
,
MAX_TIME_NAME
,
true
);
this
.
result
(
timeout
.
getData
()
);
}
}
return
true
;
...
...
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