Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
d4877cb0
Commit
d4877cb0
authored
Jul 19, 2023
by
赵浩琳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志打印参数过滤不能序列化的参数
parent
e14b6393
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
LogCallHttpAspect.java
...n/quantgroup/xyqb/aspect/logcaller/LogCallHttpAspect.java
+8
-2
No files found.
src/main/java/cn/quantgroup/xyqb/aspect/logcaller/LogCallHttpAspect.java
View file @
d4877cb0
...
@@ -3,6 +3,10 @@ package cn.quantgroup.xyqb.aspect.logcaller;
...
@@ -3,6 +3,10 @@ package cn.quantgroup.xyqb.aspect.logcaller;
import
cn.quantgroup.xyqb.util.IpUtil
;
import
cn.quantgroup.xyqb.util.IpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
import
com.google.common.base.Stopwatch
;
import
java.io.Serializable
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Around
;
...
@@ -51,8 +55,10 @@ public class LogCallHttpAspect {
...
@@ -51,8 +55,10 @@ public class LogCallHttpAspect {
long
elapsed
=
stopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
);
long
elapsed
=
stopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
);
String
resultStr
=
result
==
null
?
""
:
JSON
.
toJSONString
(
result
);
String
resultStr
=
result
==
null
?
""
:
JSON
.
toJSONString
(
result
);
resultStr
=
resultStr
.
length
()
<
500
?
resultStr
:
resultStr
.
substring
(
0
,
500
);
resultStr
=
resultStr
.
length
()
<
500
?
resultStr
:
resultStr
.
substring
(
0
,
500
);
log
.
info
(
"[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],exception:[{}],result:[{}]"
,
List
<
Object
>
argList
=
Arrays
.
stream
(
args
).
filter
(
arg
->
arg
instanceof
Serializable
)
request
.
getRequestURL
(),
elapsed
,
slowlyTag
(
elapsed
),
remoteIP
,
hasException
,
resultStr
);
.
collect
(
Collectors
.
toList
());
log
.
info
(
"[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],args:[{}],exception:[{}],result:[{}]"
,
request
.
getRequestURL
(),
elapsed
,
slowlyTag
(
elapsed
),
remoteIP
,
JSON
.
toJSONString
(
argList
),
hasException
,
resultStr
);
}
}
return
result
;
return
result
;
}
}
...
...
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