Skip to content

Commit

Permalink
Feature/consolelog healthcheck (#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
HzjNeverStop authored Feb 15, 2022
1 parent 73bdebe commit c1018f7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
*/
public class AfterReadinessCheckCallbackProcessor {

private static Logger logger = HealthCheckLoggerFactory
.getLogger(AfterReadinessCheckCallbackProcessor.class);
private static Logger logger = HealthCheckLoggerFactory.DEFAULT_LOG;

private ObjectMapper objectMapper = new ObjectMapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
*/
package com.alipay.sofa.healthcheck;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

import com.alipay.sofa.boot.error.ErrorCode;
import com.alipay.sofa.boot.constant.SofaBootConstants;
import com.alipay.sofa.boot.error.ErrorCode;
import com.alipay.sofa.boot.health.NonReadinessCheck;
import com.alipay.sofa.boot.util.BinaryOperators;
import com.alipay.sofa.healthcheck.core.HealthCheckExecutor;
import com.alipay.sofa.healthcheck.core.HealthChecker;
import com.alipay.sofa.healthcheck.log.HealthCheckLoggerFactory;
import com.alipay.sofa.healthcheck.util.HealthCheckUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -35,13 +34,13 @@
import org.springframework.context.ApplicationContext;
import org.springframework.util.Assert;

import com.alipay.sofa.boot.health.NonReadinessCheck;
import com.alipay.sofa.boot.util.BinaryOperators;
import com.alipay.sofa.healthcheck.core.HealthChecker;
import com.alipay.sofa.healthcheck.log.HealthCheckLoggerFactory;
import com.alipay.sofa.healthcheck.util.HealthCheckUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

/**
* Used to process all implementations of {@link HealthChecker}
Expand All @@ -52,8 +51,7 @@
*/
public class HealthCheckerProcessor {

private static Logger logger = HealthCheckLoggerFactory
.getLogger(HealthCheckerProcessor.class);
private static Logger logger = HealthCheckLoggerFactory.DEFAULT_LOG;

private ObjectMapper objectMapper = new ObjectMapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
* @version 2.3.0
*/
public class HealthIndicatorProcessor {
private static Logger logger = HealthCheckLoggerFactory
.getLogger(HealthIndicatorProcessor.class);
private static Logger logger = HealthCheckLoggerFactory.DEFAULT_LOG;

private static final List<String> DEFAULT_EXCLUDE_INDICATORS = Arrays
.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
*/
public class ReadinessCheckListener implements ApplicationContextAware, Ordered,
GenericApplicationListener {
private static Logger logger = HealthCheckLoggerFactory
.getLogger(ReadinessCheckListener.class);
private static Logger logger = HealthCheckLoggerFactory.DEFAULT_LOG;

private final StatusAggregator statusAggregator = StatusAggregator
.getDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
* @since 3.7.1
*/
public class HealthCheckExecutor {
private static Logger logger = HealthCheckLoggerFactory
.getLogger(HealthCheckExecutor.class);
private static Logger logger = HealthCheckLoggerFactory.DEFAULT_LOG;

private static final ThreadPoolExecutor THREAD_POOL_REF = createThreadPoolExecutor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/
package com.alipay.sofa.healthcheck.log;

import org.slf4j.Logger;

import com.alipay.sofa.common.log.LoggerSpaceManager;
import org.slf4j.Logger;

/**
* @author liangen
Expand All @@ -28,6 +27,9 @@ public class HealthCheckLoggerFactory {

private static final String HEALTH_CHECK_LOG_SPACE = "com.alipay.sofa.healthcheck";

public static final Logger DEFAULT_LOG = HealthCheckLoggerFactory
.getLogger("com.alipay.sofa");

/***
* Get the log object
*
Expand Down

0 comments on commit c1018f7

Please sign in to comment.