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