1、增加debug信息开关

2、修正DETECTION_INFO_WARNING insert语句
This commit is contained in:
fangshunjian
2018-12-21 19:13:35 +06:00
parent fc5f49a016
commit 725dc8ad84
7 changed files with 49 additions and 11 deletions

View File

@@ -8,6 +8,8 @@ import java.util.List;
import org.apache.log4j.Logger;
import com.nms.server.common.Constants;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
@@ -101,14 +103,18 @@ public class MessageDecoder extends ByteToMessageDecoder {
if(m != null){
out.add(m);
init();
logger.debug("成功组包一条消息type : " +m.getBusinessType().getName() +",length : " + m.getLength());
if(Constants.DEBUG_MESSAGEDECODER_DECODE) {
logger.debug("成功组包一条消息type : " +m.getBusinessType().getName() +",length : " + m.getLength());
}
}
}
private Message decode(ByteBuf in) throws Exception{
int readableBytes = in.readableBytes();
logger.debug("decode begin,flag:"+flag+ " ,readableBytes:" + readableBytes);
if(Constants.DEBUG_MESSAGEDECODER_DECODE) {
logger.debug("decode begin,flag:"+flag+ " ,readableBytes:" + readableBytes);
}
if(flag && readableBytes < (headerLength)){//初始状态,且不能读取 协议头
return null;
}
@@ -181,7 +187,9 @@ public class MessageDecoder extends ByteToMessageDecoder {
}
throw e;
}
logger.debug("decode end,type : "+businessType.getName()+" bodyLength: "+bodyLength+" , remain :" +remain);
if(Constants.DEBUG_MESSAGEDECODER_DECODE) {
logger.debug("decode end,type : "+businessType.getName()+" bodyLength: "+bodyLength+" , remain :" +remain);
}
return null;
}