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
b01982d7
Commit
b01982d7
authored
Mar 19, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
不记录系统日志
parent
aada195b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
5 deletions
+39
-5
LogBase.java
...loud/src/main/java/com/yanzuoguang/cloud/aop/LogBase.java
+8
-5
LogFeignDefault.java
.../main/java/com/yanzuoguang/cloud/aop/LogFeignDefault.java
+31
-0
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/LogBase.java
View file @
b01982d7
...
...
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.InitializingBean;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
/**
...
...
@@ -21,7 +22,7 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
protected
volatile
LinkedBlockingQueue
<
LogVo
>
cache
=
new
LinkedBlockingQueue
<>();
@Autowired
protected
L
ogFeign
logFeign
;
protected
L
ist
<
LogFeign
>
logFeigns
;
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
...
...
@@ -58,10 +59,12 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
while
(
cache
.
size
()
>
0
)
{
LogVo
item
=
cache
.
poll
();
if
(
item
!=
null
)
{
try
{
logFeign
.
save
(
item
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
for
(
LogFeign
log
:
logFeigns
)
{
try
{
log
.
save
(
item
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
}
}
}
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/LogFeignDefault.java
0 → 100644
View file @
b01982d7
package
com
.
yanzuoguang
.
cloud
.
aop
;
import
com.yanzuoguang.util.vo.LogVo
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.springframework.stereotype.Component
;
/**
* 日志默认处理服务
*
* @author 颜佐光
*/
@Component
public
class
LogFeignDefault
implements
LogFeign
{
private
boolean
init
=
false
;
/**
* 保存日志对象
*
* @param log 需要保存的日志对象
* @return 日志服务返回结果
*/
@Override
public
ResponseResult
<
String
>
save
(
LogVo
log
)
{
if
(!
init
)
{
init
=
true
;
System
.
err
.
println
(
"请添加处理日志服务,实现LogFeign接口!"
);
}
return
ResponseResult
.
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