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
ea9648f1
Commit
ea9648f1
authored
Mar 19, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
不记录系统日志
parent
426d1092
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
8 deletions
+28
-8
BaseRequestAspect.java
...ain/java/com/yanzuoguang/cloud/aop/BaseRequestAspect.java
+1
-1
FeignAspect.java
.../src/main/java/com/yanzuoguang/cloud/aop/FeignAspect.java
+11
-2
LogLocal.java
...oud/src/main/java/com/yanzuoguang/cloud/aop/LogLocal.java
+1
-1
MqAspect.java
...oud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
+4
-1
WebAspect.java
...ud/src/main/java/com/yanzuoguang/cloud/aop/WebAspect.java
+11
-3
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/BaseRequestAspect.java
View file @
ea9648f1
...
@@ -191,7 +191,7 @@ public class BaseRequestAspect {
...
@@ -191,7 +191,7 @@ public class BaseRequestAspect {
protected
void
responseLog
(
LogVo
log
,
String
tag
,
boolean
logFlag
,
ProceedingJoinPoint
joinPoint
,
long
start
,
Object
result
,
Exception
resultEx
)
{
protected
void
responseLog
(
LogVo
log
,
String
tag
,
boolean
logFlag
,
ProceedingJoinPoint
joinPoint
,
long
start
,
Object
result
,
Exception
resultEx
)
{
try
{
try
{
long
time
=
System
.
currentTimeMillis
()
-
start
;
long
time
=
System
.
currentTimeMillis
()
-
start
;
boolean
isLog
=
(
logFlag
&&
logCommon
)
||
resultEx
!=
null
;
boolean
isLog
=
(
logFlag
&&
logCommon
&&
this
.
logLocal
.
isLog
()
)
||
resultEx
!=
null
;
String
name
=
joinPoint
.
getSignature
().
getName
();
String
name
=
joinPoint
.
getSignature
().
getName
();
// 处理结果
// 处理结果
ResponseResult
responseResult
=
responseDefault
;
ResponseResult
responseResult
=
responseDefault
;
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/FeignAspect.java
View file @
ea9648f1
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.aop;
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.aop;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.vo.LogVo
;
import
com.yanzuoguang.util.vo.LogVo
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
@@ -37,9 +38,17 @@ public class FeignAspect extends BaseRequestAspect {
...
@@ -37,9 +38,17 @@ public class FeignAspect extends BaseRequestAspect {
*/
*/
@Around
(
value
=
"feignAspect()"
)
@Around
(
value
=
"feignAspect()"
)
public
Object
requestFeignAround
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
public
Object
requestFeignAround
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
LogVo
log
=
null
;
boolean
clear
=
requestLogInit
();
boolean
clear
=
requestLogInit
();
long
start
=
requestLog
(
TAG
,
clear
,
joinPoint
);
long
start
=
System
.
currentTimeMillis
();
LogVo
log
=
startLog
(
TAG
,
getMethodUrl
(
joinPoint
),
getRequestBody
(
joinPoint
));
if
(
clear
)
{
log
=
startLog
(
TAG
,
getMethodUrl
(
joinPoint
),
getRequestBody
(
joinPoint
));
clear
=
clear
&&
log
!=
null
;
}
if
(
clear
)
{
Log
.
threadBegin
();
start
=
requestLog
(
TAG
,
clear
,
joinPoint
);
}
Object
result
=
null
;
Object
result
=
null
;
Exception
ex
=
null
;
Exception
ex
=
null
;
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/LogLocal.java
View file @
ea9648f1
...
@@ -167,7 +167,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
...
@@ -167,7 +167,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
* @param keys
* @param keys
* @return
* @return
*/
*/
p
rivate
boolean
isLog
(
String
...
keys
)
{
p
ublic
boolean
isLog
(
String
...
keys
)
{
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
this
.
applicationName
);
list
.
add
(
this
.
applicationName
);
for
(
String
item
:
keys
)
{
for
(
String
item
:
keys
)
{
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
View file @
ea9648f1
...
@@ -45,10 +45,13 @@ public class MqAspect extends BaseRequestAspect {
...
@@ -45,10 +45,13 @@ public class MqAspect extends BaseRequestAspect {
boolean
clear
=
isRabbit
(
joinPoint
);
boolean
clear
=
isRabbit
(
joinPoint
);
LogVo
log
=
null
;
LogVo
log
=
null
;
long
start
=
System
.
currentTimeMillis
();
long
start
=
System
.
currentTimeMillis
();
if
(
clear
)
{
log
=
startLog
(
TAG
,
getMethodUrl
(
joinPoint
),
getRequestBody
(
joinPoint
));
clear
=
clear
&&
log
!=
null
;
}
if
(
clear
)
{
if
(
clear
)
{
Log
.
threadBegin
();
Log
.
threadBegin
();
start
=
requestLog
(
TAG
,
clear
,
joinPoint
);
start
=
requestLog
(
TAG
,
clear
,
joinPoint
);
log
=
startLog
(
TAG
,
getMethodUrl
(
joinPoint
),
getRequestBody
(
joinPoint
));
}
}
Object
result
=
null
;
Object
result
=
null
;
Exception
ex
=
null
;
Exception
ex
=
null
;
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/WebAspect.java
View file @
ea9648f1
...
@@ -70,10 +70,18 @@ public class WebAspect extends BaseRequestAspect {
...
@@ -70,10 +70,18 @@ public class WebAspect extends BaseRequestAspect {
result
=
executeMethod
(
joinPoint
);
result
=
executeMethod
(
joinPoint
);
return
result
;
return
result
;
}
}
LogVo
log
=
null
;
boolean
clear
=
requestLogInit
();
boolean
clear
=
requestLogInit
();
// 用户数据库记录
long
start
=
System
.
currentTimeMillis
();
long
start
=
requestLog
(
TAG
,
clear
,
joinPoint
);
if
(
clear
)
{
LogVo
log
=
startLog
(
TAG
,
HttpAspectUtil
.
getHttpRequestUrl
(),
getRequestBody
(
joinPoint
));
log
=
startLog
(
TAG
,
getMethodUrl
(
joinPoint
),
getRequestBody
(
joinPoint
));
clear
=
clear
&&
log
!=
null
;
}
if
(
clear
)
{
Log
.
threadBegin
();
start
=
requestLog
(
TAG
,
clear
,
joinPoint
);
}
Exception
ex
=
null
;
Exception
ex
=
null
;
boolean
isInit
=
false
;
boolean
isInit
=
false
;
try
{
try
{
...
...
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