mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
try to avoid use multiline exception directly
This commit is contained in:
@@ -430,7 +430,7 @@ public abstract class AbstractEventParser<EVENT> extends AbstractCanalLifeCycle
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.warn("heartBeat run failed " + ExceptionUtils.getStackTrace(e));
|
||||
logger.warn("heartBeat run failed ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -167,25 +166,25 @@ public class MysqlConnection implements ErosaConnection {
|
||||
try {
|
||||
update("set wait_timeout=9999999");
|
||||
} catch (Exception e) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update wait_timeout failed", e);
|
||||
}
|
||||
try {
|
||||
update("set net_write_timeout=1800");
|
||||
} catch (Exception e) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update net_write_timeout failed", e);
|
||||
}
|
||||
|
||||
try {
|
||||
update("set net_read_timeout=1800");
|
||||
} catch (Exception e) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update net_read_timeout failed", e);
|
||||
}
|
||||
|
||||
try {
|
||||
// 设置服务端返回结果时不做编码转化,直接按照数据库的二进制编码进行发送,由客户端自己根据需求进行编码转化
|
||||
update("set names 'binary'");
|
||||
} catch (Exception e) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update names failed", e);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -195,7 +194,7 @@ public class MysqlConnection implements ErosaConnection {
|
||||
// 但也不能乱设置,需要和mysql server的checksum配置一致,不然RotateLogEvent会出现乱码
|
||||
update("set @master_binlog_checksum= '@@global.binlog_checksum'");
|
||||
} catch (Exception e) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update master_binlog_checksum failed", e);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -204,7 +203,7 @@ public class MysqlConnection implements ErosaConnection {
|
||||
update("set @slave_uuid=uuid()");
|
||||
} catch (Exception e) {
|
||||
if (!StringUtils.contains(e.getMessage(), "Unknown system variable")) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update slave_uuid failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +211,7 @@ public class MysqlConnection implements ErosaConnection {
|
||||
// mariadb针对特殊的类型,需要设置session变量
|
||||
update("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'");
|
||||
} catch (Exception e) {
|
||||
logger.warn(ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn("update mariadb_slave_capability failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.alibaba.otter.canal.common.utils.JsonUtils;
|
||||
@@ -237,19 +236,19 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE
|
||||
((HeartBeatCallback) haController).onFailed(e);
|
||||
}
|
||||
reconnect = true;
|
||||
logger.warn("connect failed by " + ExceptionUtils.getStackTrace(e));
|
||||
logger.warn("connect failed by ", e);
|
||||
} catch (IOException e) {
|
||||
if (haController != null && haController instanceof HeartBeatCallback) {
|
||||
((HeartBeatCallback) haController).onFailed(e);
|
||||
}
|
||||
reconnect = true;
|
||||
logger.warn("connect failed by " + ExceptionUtils.getStackTrace(e));
|
||||
logger.warn("connect failed by ", e);
|
||||
} catch (Throwable e) {
|
||||
if (haController != null && haController instanceof HeartBeatCallback) {
|
||||
((HeartBeatCallback) haController).onFailed(e);
|
||||
}
|
||||
reconnect = true;
|
||||
logger.warn("connect failed by " + ExceptionUtils.getStackTrace(e));
|
||||
logger.warn("connect failed by ", e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -549,9 +548,8 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE
|
||||
return entryPosition;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("the binlogfile:{} doesn't exist, to continue to search the next binlogfile , caused by {}",
|
||||
startSearchBinlogFile,
|
||||
ExceptionUtils.getFullStackTrace(e));
|
||||
logger.warn(String.format("the binlogfile:%s doesn't exist, to continue to search the next binlogfile , caused by",
|
||||
startSearchBinlogFile), e);
|
||||
int binlogSeqNum = Integer.parseInt(startSearchBinlogFile.substring(startSearchBinlogFile.indexOf(".") + 1));
|
||||
if (binlogSeqNum <= 1) {
|
||||
logger.warn("Didn't find the corresponding binlog files");
|
||||
|
||||
Reference in New Issue
Block a user