未验证 提交 aa5a0783 编写于 作者: H He Wang 提交者: GitHub

format logger message (#39)

* format logger message

* revert logic change
上级 1a92566f
...@@ -941,7 +941,7 @@ public class LogMessage extends DataMessage.Record { ...@@ -941,7 +941,7 @@ public class LogMessage extends DataMessage.Record {
} }
int j = keyStr.indexOf(')', i); int j = keyStr.indexOf(')', i);
if (j == -1) { if (j == -1) {
log.error("parse key error"); log.error("Parse key error");
return null; return null;
} }
m = j; m = j;
...@@ -1077,7 +1077,7 @@ public class LogMessage extends DataMessage.Record { ...@@ -1077,7 +1077,7 @@ public class LogMessage extends DataMessage.Record {
} }
return primaryValues; return primaryValues;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new LogMessageException(e.getMessage(), e.getCause());
} }
} }
......
...@@ -132,8 +132,12 @@ public class ObReaderConfig extends AbstractConnectionConfig { ...@@ -132,8 +132,12 @@ public class ObReaderConfig extends AbstractConnectionConfig {
+ ", cluster_password=******, " + ", cluster_password=******, "
+ "tb_white_list=" + "tb_white_list="
+ TABLE_WHITE_LIST + TABLE_WHITE_LIST
+ ", tb_black_list="
+ TABLE_BLACK_LIST
+ ", start_timestamp=" + ", start_timestamp="
+ START_TIMESTAMP; + START_TIMESTAMP
+ ", timezone="
+ TIME_ZONE;
} }
/** /**
......
...@@ -226,7 +226,7 @@ public class ClientHandler extends ChannelInboundHandlerAdapter { ...@@ -226,7 +226,7 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
byte[] bytes = new byte[dataLength]; byte[] bytes = new byte[dataLength];
buffer.readBytes(bytes); buffer.readBytes(bytes);
LogProxyProto.RuntimeStatus response = LogProxyProto.RuntimeStatus.parseFrom(bytes); LogProxyProto.RuntimeStatus response = LogProxyProto.RuntimeStatus.parseFrom(bytes);
logger.debug("server status: {}", response.toString()); logger.debug("Server status: {}", response.toString());
state = HandshakeStateV1.PB_HEAD; state = HandshakeStateV1.PB_HEAD;
} else { } else {
dataNotEnough = true; dataNotEnough = true;
...@@ -252,18 +252,18 @@ public class ClientHandler extends ChannelInboundHandlerAdapter { ...@@ -252,18 +252,18 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
*/ */
private void checkHeader(int version, int type, int length) { private void checkHeader(int version, int type, int length) {
if (ProtocolVersion.codeOf(version) == null) { if (ProtocolVersion.codeOf(version) == null) {
logger.error("unsupported protocol version: {}", version); logger.error("Unsupported protocol version: {}", version);
throw new LogProxyClientException( throw new LogProxyClientException(
ErrorCode.E_PROTOCOL, "unsupported protocol version: " + version); ErrorCode.E_PROTOCOL, "Unsupported protocol version: " + version);
} }
if (HeaderType.codeOf(type) == null) { if (HeaderType.codeOf(type) == null) {
logger.error("unsupported header type: {}", type); logger.error("Unsupported header type: {}", type);
throw new LogProxyClientException( throw new LogProxyClientException(
ErrorCode.E_HEADER_TYPE, "unsupported header type: " + type); ErrorCode.E_HEADER_TYPE, "Unsupported header type: " + type);
} }
if (length <= 0) { if (length <= 0) {
logger.error("data length equals 0"); logger.error("Data length equals 0");
throw new LogProxyClientException(ErrorCode.E_LEN, "data length equals 0"); throw new LogProxyClientException(ErrorCode.E_LEN, "Data length equals 0");
} }
} }
...@@ -453,8 +453,8 @@ public class ClientHandler extends ChannelInboundHandlerAdapter { ...@@ -453,8 +453,8 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
poolFlag = false; poolFlag = false;
logger.info( logger.info(
"Connect broken of ClientId: {} with LogProxy: {}", "Channel closed with ClientId: {}, LogProxy: {}",
params.info(), params.getClientId(),
NetworkUtil.parseRemoteAddress(ctx.channel())); NetworkUtil.parseRemoteAddress(ctx.channel()));
ctx.channel().disconnect(); ctx.channel().disconnect();
ctx.close(); ctx.close();
......
...@@ -41,7 +41,7 @@ public class Connection { ...@@ -41,7 +41,7 @@ public class Connection {
/** Close this connection. */ /** Close this connection. */
public void close() { public void close() {
if (!closed.compareAndSet(false, true)) { if (!closed.compareAndSet(false, true)) {
logger.warn("connection already closed"); logger.warn("Connection already closed");
} }
if (channel != null) { if (channel != null) {
if (channel.isActive()) { if (channel.isActive()) {
...@@ -49,7 +49,7 @@ public class Connection { ...@@ -49,7 +49,7 @@ public class Connection {
channel.close().addListener(this::logCloseResult).syncUninterruptibly(); channel.close().addListener(this::logCloseResult).syncUninterruptibly();
} catch (Exception e) { } catch (Exception e) {
logger.warn( logger.warn(
"close connection to remote address {} exception", "Close connection to remote address {} exception",
NetworkUtil.parseRemoteAddress(channel), NetworkUtil.parseRemoteAddress(channel),
e); e);
} }
...@@ -68,12 +68,12 @@ public class Connection { ...@@ -68,12 +68,12 @@ public class Connection {
if (future.isSuccess()) { if (future.isSuccess()) {
if (logger.isInfoEnabled()) { if (logger.isInfoEnabled()) {
logger.info( logger.info(
"close connection to remote address {} success", "Close connection to remote address {} success",
NetworkUtil.parseRemoteAddress(channel)); NetworkUtil.parseRemoteAddress(channel));
} }
} else { } else {
logger.warn( logger.warn(
"close connection to remote address {} fail", "Close connection to remote address {} fail",
NetworkUtil.parseRemoteAddress(channel), NetworkUtil.parseRemoteAddress(channel),
future.cause()); future.cause());
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册