10-20 15:30:39.444: E/MoGuLogger(19145): 2015-10-20 15:30:39:449 - [MsgServerHandler.java:68] - 2053 - channel#[网络异常了]exceptionCaught e.toString:[id: 0xd0c2ae80, /192.168.100.20:47249
=> /61.145.164.198:8000] EXCEPTION: java.util.IllegalFormatConversionException: %d can't format com.mogujie.tt.protobuf.IMBaseDefine$ResultType arguments
=> /61.145.164.198:8000] EXCEPTION: java.util.IllegalFormatConversionException: %d can't format com.mogujie.tt.protobuf.IMBaseDefine$ResultType arguments
以上异常是public class MsgServerHandler extends SimpleChannelHandler的以下方法打印的。
@Overridepublic void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {super.exceptionCaught(ctx, e);if(e.getChannel() == null || !e.getChannel().isConnected()){IMSocketManager.instance().onConnectMsgServerFail();}logger.e("channel#[网络异常了]exceptionCaught e.toString:%s", e.toString());logger.e("channel#[网络异常了]exceptionCaught:%s", e.getCause().toString());}
问题原因:
在另一个类中日志打印类型错误。
IMBaseDefine.ResultType code = loginRes.getResultCode();
logger.d("login#switch code:%d",code);
修改方法:
IMBaseDefine.ResultType code = loginRes.getResultCode();
logger.d("login#switch code:%s",code.values());