From a9fddf438126c00ce56a66fe6803c27f9b26af95 Mon Sep 17 00:00:00 2001 From: whhe Date: Tue, 19 Oct 2021 17:54:29 +0800 Subject: [PATCH] add exception message in reconnect log (#2) --- .../oceanbase/clogproxy/client/config/ObReaderConfig.java | 5 +++++ .../oceanbase/clogproxy/client/connection/ClientStream.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java index 225f8a4..bf2e138 100644 --- a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java +++ b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java @@ -16,10 +16,14 @@ import com.oceanbase.clogproxy.common.config.ShareConf; import com.oceanbase.clogproxy.common.packet.LogType; import com.oceanbase.clogproxy.common.util.CryptoUtil; import com.oceanbase.clogproxy.common.util.Hex; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class ObReaderConfig extends AbstractConnectionConfig { + private static final Logger logger = LoggerFactory.getLogger(ObReaderConfig.class); + private static final ConfigItem RS_LIST = new ConfigItem<>("rootserver_list", ""); private static final ConfigItem CLUSTER_USER = new ConfigItem<>("cluster_user", ""); private static final ConfigItem CLUSTER_PASSWORD = new ConfigItem<>("cluster_password", ""); @@ -50,6 +54,7 @@ public class ObReaderConfig extends AbstractConnectionConfig { } return true; } catch (IllegalArgumentException e) { + logger.error(e.getMessage()); return false; } } diff --git a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java index 45ab63d..f8baf85 100644 --- a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java +++ b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java @@ -159,7 +159,7 @@ public class ClientStream { return; } catch (Exception e) { - // if exception occured, we exit + // if exception occurred, we exit triggerStop(); triggerException(new LogProxyClientException(ErrorCode.E_USER, e)); return; @@ -221,7 +221,7 @@ public class ClientStream { return ReconnectState.RETRY; } catch (Exception e) { - logger.error("failed to reconnect, retry count: {}, max: {}", ++retryTimes, ClientConf.MAX_RECONNECT_TIMES); + logger.error("failed to reconnect, retry count: {}, max: {}, message: {}", ++retryTimes, ClientConf.MAX_RECONNECT_TIMES, e.getMessage()); // not success, retry next time reconnect.set(true); return ReconnectState.RETRY; -- GitLab