optimize - 调整 starter 中的日志输出级别,减少不必要的日志打印
This commit is contained in:
parent
db3f40e6f2
commit
21ff034e83
@ -66,7 +66,9 @@ public class ErrorReportAspect implements Ordered {
|
||||
*/
|
||||
@Around(value = "@within(org.springframework.web.bind.annotation.RestController) || @within(org.springframework.stereotype.Service)")
|
||||
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
log.info("{}.{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("{}.{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
|
||||
}
|
||||
Signature signature = joinPoint.getSignature();
|
||||
StopWatch watch = new StopWatch("running controller time");
|
||||
watch.start(signature.toShortString());
|
||||
@ -75,10 +77,14 @@ public class ErrorReportAspect implements Ordered {
|
||||
result = joinPoint.proceed();
|
||||
} finally {
|
||||
watch.stop();
|
||||
log.info("StopWatch '{}': running time = {} 's", watch.getLastTaskName(), watch.getTotalTimeSeconds());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("StopWatch '{}': running time = {} 's", watch.getLastTaskName(), watch.getTotalTimeSeconds());
|
||||
}
|
||||
|
||||
if (!methodNames.contains(watch.getLastTaskName())) {
|
||||
log.info("StopWatch '{}': running time = {} 's", watch.getLastTaskName(), watch.getTotalTimeSeconds());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("StopWatch '{}': running time = {} 's", watch.getLastTaskName(), watch.getTotalTimeSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
if (!signature.toShortString().contains("ExtAxApiLogServiceImpl")) {
|
||||
@ -128,7 +134,9 @@ public class ErrorReportAspect implements Ordered {
|
||||
*/
|
||||
@AfterThrowing(pointcut = "@within(errorReporter) && @annotation(operation)", throwing = "e", argNames = "joinPoint,errorReporter,operation,e")
|
||||
public void doAfterThrowing(JoinPoint joinPoint, ErrorReporter errorReporter, Operation operation, Exception e) {
|
||||
log.info("ErrorReportAspect 记录异常信息: {}", e.getMessage());
|
||||
if(log.isDebugEnabled()) {
|
||||
log.debug("ErrorReportAspect 记录异常信息: {}", e.getMessage());
|
||||
}
|
||||
EnvConfig[] envConfigs = errorReporter.envConfig();
|
||||
for (EnvConfig envConfig : envConfigs) {
|
||||
if (Arrays.asList(envConfig.profiles()).contains(profile)) {
|
||||
|
||||
@ -107,7 +107,9 @@ public class StarterBroadcastMQConfiguration {
|
||||
// 处理 properties 配置进行事件过滤
|
||||
for (InnerMessageQueueHandleBeforeFilter filter : filters) {
|
||||
if (filter.doFilter(message)) {
|
||||
log.info("【{}】message has been filtered, messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("【{}】message has been filtered, messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,9 @@ public class StarterRPCInvokeMQConfiguration {
|
||||
private BiConsumer<Event, EventProducer.Context<RocketMQEventProducer.RocketMQMessageMeta>> getSendBeforeCallback() {
|
||||
return (event, context) -> {
|
||||
event.setEventId(IdHelper.get32UUID());
|
||||
log.info("mq_send_Before: {}, uniqueId: {}", event.getShardingKey(), event.getEventId());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("mq_send_Before: {}, uniqueId: {}", event.getShardingKey(), event.getEventId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -119,7 +121,9 @@ public class StarterRPCInvokeMQConfiguration {
|
||||
private BiConsumer<Event, EventProducer.Context<RocketMQEventProducer.RocketMQMessageMeta>> getSendAfterCallback() {
|
||||
return (event, context) -> {
|
||||
String messageId = context.getHeaders().get(MQ_MESSAGE_ID);
|
||||
log.info("mq_send_after: {}, uniqueId: {}, messageId: {}", event.getShardingKey(), event.getEventId(), messageId);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("mq_send_after: {}, uniqueId: {}, messageId: {}", event.getShardingKey(), event.getEventId(), messageId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -132,7 +136,9 @@ public class StarterRPCInvokeMQConfiguration {
|
||||
*/
|
||||
private BiConsumer<Event, EventProducer.Context<RocketMQEventProducer.RocketMQMessageMeta>> getTransactionRollbackHandler() {
|
||||
return (event, context) -> {
|
||||
log.info("mq_transaction_rollback: {}, uniqueId: {}", event.getShardingKey(), event.getEventId());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("mq_transaction_rollback: {}, uniqueId: {}", event.getShardingKey(), event.getEventId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -154,7 +160,9 @@ public class StarterRPCInvokeMQConfiguration {
|
||||
if (eventWrapper.isHandled()) {
|
||||
// 只收集被App真正消费的消息.
|
||||
Event event = eventWrapper.getEvent();
|
||||
log.info("WorkflowEngineStarter RPC MQ, handled event: {}", event.toPrettyJsonString());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("WorkflowEngineStarter RPC MQ, handled event: {}", event.toPrettyJsonString());
|
||||
}
|
||||
}
|
||||
};
|
||||
return new DefaultEventConsumer(applicationName + MODULE_NAME_SUFFIX, workflowEngineStarterEventHandlerRepository, callback);
|
||||
@ -182,7 +190,9 @@ public class StarterRPCInvokeMQConfiguration {
|
||||
@Override
|
||||
public void onMessage(MessageExt message) {
|
||||
if (filter.doFilter(message)) {
|
||||
log.info("【{}】message has been filtered, messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("【{}】message has been filtered, messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.onEvent(message, workflowEngineStarterEventConsumer);
|
||||
|
||||
@ -101,7 +101,9 @@ public class WorkflowEngineStarterAutoConfiguration {
|
||||
private ExecuteInterceptor getFailInterceptor(WorkflowEngineStarterProperties starterProperties) {
|
||||
BroadcastListenerProperties listenerRetry = starterProperties.getBroadcast();
|
||||
FailHandleTypeEnum failHandleType = listenerRetry.getFailHandleType();
|
||||
log.info("workflow engine starter fail handle type : {}", failHandleType);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("workflow engine starter fail handle type : {}", failHandleType);
|
||||
}
|
||||
switch (failHandleType) {
|
||||
case FAIL_BACK:
|
||||
// return new FailBackInterceptor();
|
||||
|
||||
@ -72,7 +72,9 @@ final class WorkflowEngineStarterDecoder implements Decoder {
|
||||
wrappedType = ParameterizedTypeImpl.make(CommonResponse.class, new Type[]{type}, null);
|
||||
}
|
||||
Object decode = delegate.decode(response, wrappedType);
|
||||
log.info("workflow engine starter response :{}", JSON.toJSONString(decode));
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("workflow engine starter response :{}", JSON.toJSONString(decode));
|
||||
}
|
||||
if (decode instanceof CommonResponse) {
|
||||
CommonResponse<?> commonResponse = (CommonResponse<?>) decode;
|
||||
if (response.status() == 202) {
|
||||
|
||||
@ -61,8 +61,10 @@ class WorkflowEngineStarterInvocationHandler implements InvocationHandler {
|
||||
stopWatch.stop();
|
||||
List<String> ignoreMethods = Lists.newArrayList("sync", "async");
|
||||
if (!ignoreMethods.contains(method.getName())) {
|
||||
log.info("Workflow starter Method invoke record: {}.{}, args: {}, result: {} const: {} ms",
|
||||
target.type().getSimpleName(), method.getName(), JSON.toJSONString(args), JSON.toJSONString(invoke), stopWatch.getTotalTimeMillis());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Workflow starter Method invoke record: {}.{}, args: {}, result: {} const: {} ms",
|
||||
target.type().getSimpleName(), method.getName(), JSON.toJSONString(args), JSON.toJSONString(invoke), stopWatch.getTotalTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
return invoke;
|
||||
|
||||
@ -35,7 +35,9 @@ public final class FailOverInterceptor extends AbstractListenerInterceptor {
|
||||
int failedAttempts = 0;
|
||||
do {
|
||||
if (failedAttempts > 0) {
|
||||
log.info("Waiting for {} ms before retrying the command. retryTimes: {}", waitTime, failedAttempts);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Waiting for {} ms before retrying the command. retryTimes: {}", waitTime, failedAttempts);
|
||||
}
|
||||
waitBeforeRetry(waitTime);
|
||||
waitTime *= waitIncreaseFactor;
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@ public final class LogInterceptor extends AbstractListenerInterceptor {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("--- starting handle mq ---- ");
|
||||
}
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("messageId: {}, eventCode: {}, messageBody: {}", context.getMsgId(), context.getEventCode().toString(), JSON.toJSONString(t));
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("messageId: {}, eventCode: {}, messageBody: {}", context.getMsgId(), context.getEventCode().toString(), JSON.toJSONString(t));
|
||||
}
|
||||
try {
|
||||
getNext().execute(executor, consumer, context, t);
|
||||
|
||||
@ -59,7 +59,9 @@ public abstract class AbstractInnerWorkflowListener<H extends Ordered, F extends
|
||||
if (!CollectionUtils.isEmpty(businessListeners)) {
|
||||
for (F filter : businessFilters) {
|
||||
if (filter.doFilter(event, context, convert)) {
|
||||
log.info("【{}】filtered message, messageId: {}", filter.getClass().getSimpleName(), context.getMsgId());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("【{}】filtered message, messageId: {}", filter.getClass().getSimpleName(), context.getMsgId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user