优化日志
This commit is contained in:
parent
60692f5ff6
commit
36f56b40dd
@ -27,10 +27,6 @@ public class LogMdcConfiguration {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void contextOperatorHook() {
|
public void contextOperatorHook() {
|
||||||
Hooks.onEachOperator(PRINT_LOG_ID, Operators.lift((r, c) ->{
|
Hooks.onEachOperator(PRINT_LOG_ID, Operators.lift((r, c) ->{
|
||||||
/*Context ctx = c.currentContext();
|
|
||||||
if(ctx.hasKey(PRINT_LOG_ID)){
|
|
||||||
MDC.put(PRINT_LOG_ID, ctx.get(PRINT_LOG_ID));
|
|
||||||
}*/
|
|
||||||
return new MdcContextSubscriber(c);
|
return new MdcContextSubscriber(c);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -69,9 +65,8 @@ public class LogMdcConfiguration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(T t) {
|
public void onNext(T t) {
|
||||||
Context ctx = currentContext();
|
if(currentContext().hasKey(PRINT_LOG_ID)){
|
||||||
if(ctx.hasKey(PRINT_LOG_ID)){
|
MDC.put(PRINT_LOG_ID, currentContext().get(PRINT_LOG_ID));
|
||||||
MDC.put(PRINT_LOG_ID, ctx.get(PRINT_LOG_ID));
|
|
||||||
}
|
}
|
||||||
coreSubscriber.onNext(t);
|
coreSubscriber.onNext(t);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,10 +26,6 @@ public class LogMdcConfiguration {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void contextOperatorHook() {
|
public void contextOperatorHook() {
|
||||||
Hooks.onEachOperator(PRINT_LOG_ID, Operators.lift((r, c) ->{
|
Hooks.onEachOperator(PRINT_LOG_ID, Operators.lift((r, c) ->{
|
||||||
Context ctx = c.currentContext();
|
|
||||||
if(ctx.hasKey(PRINT_LOG_ID)){
|
|
||||||
MDC.put(PRINT_LOG_ID, ctx.get(PRINT_LOG_ID));
|
|
||||||
}
|
|
||||||
return new MdcContextSubscriber(c);
|
return new MdcContextSubscriber(c);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -69,7 +65,9 @@ public class LogMdcConfiguration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(T t) {
|
public void onNext(T t) {
|
||||||
|
if(coreSubscriber.currentContext().hasKey(PRINT_LOG_ID)){
|
||||||
|
MDC.put(PRINT_LOG_ID, coreSubscriber.currentContext().get(PRINT_LOG_ID));
|
||||||
|
}
|
||||||
coreSubscriber.onNext(t);
|
coreSubscriber.onNext(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user