Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
0e8fa6c8
Commit
0e8fa6c8
authored
Jun 27, 2019
by
macro
Browse files
Update WebLogAspect.java
parent
5ada8a3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/component/WebLogAspect.java
View file @
0e8fa6c8
...
...
@@ -39,7 +39,6 @@ import java.util.Map;
@Order
(
1
)
public
class
WebLogAspect
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
WebLogAspect
.
class
);
private
ThreadLocal
<
Long
>
startTime
=
new
ThreadLocal
<>();
@Pointcut
(
"execution(public * com.macro.mall.controller.*.*(..))"
)
public
void
webLog
()
{
...
...
@@ -47,7 +46,6 @@ public class WebLogAspect {
@Before
(
"webLog()"
)
public
void
doBefore
(
JoinPoint
joinPoint
)
throws
Throwable
{
startTime
.
set
(
System
.
currentTimeMillis
());
}
@AfterReturning
(
value
=
"webLog()"
,
returning
=
"ret"
)
...
...
@@ -56,6 +54,7 @@ public class WebLogAspect {
@Around
(
"webLog()"
)
public
Object
doAround
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
long
startTime
=
System
.
currentTimeMillis
();
//获取当前请求对象
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
...
...
@@ -76,8 +75,8 @@ public class WebLogAspect {
webLog
.
setMethod
(
request
.
getMethod
());
webLog
.
setParameter
(
getParameter
(
method
,
joinPoint
.
getArgs
()));
webLog
.
setResult
(
result
);
webLog
.
setSpendTime
((
int
)
(
endTime
-
startTime
.
get
()
));
webLog
.
setStartTime
(
startTime
.
get
()
);
webLog
.
setSpendTime
((
int
)
(
endTime
-
startTime
));
webLog
.
setStartTime
(
startTime
);
webLog
.
setUri
(
request
.
getRequestURI
());
webLog
.
setUrl
(
request
.
getRequestURL
().
toString
());
Map
<
String
,
Object
>
logMap
=
new
HashMap
<>();
...
...
Write
Preview
Supports
Markdown
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