首页  

netty4 echo例子 日志记录     所属分类 netty 浏览量 1420
例子代码
https://gitee.com/dyyx/netty4demo/tree/master/src/main/java/dyyx/echo


启动服务 十一月 03, 2019 3:42:47 下午 io.netty.handler.logging.LoggingHandler channelRegistered 信息: [id: 0x8838db46] REGISTERED 十一月 03, 2019 3:42:47 下午 io.netty.handler.logging.LoggingHandler bind 信息: [id: 0x8838db46] BIND(0.0.0.0/0.0.0.0:6789) 十一月 03, 2019 3:42:47 下午 io.netty.handler.logging.LoggingHandler channelActive 信息: [id: 0x8838db46, /0:0:0:0:0:0:0:0:6789] ACTIVE
telnet 建立连接 十一月 03, 2019 3:43:10 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0x8838db46, /0:0:0:0:0:0:0:0:6789] RECEIVED: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] 十一月 03, 2019 3:43:10 下午 io.netty.handler.logging.LoggingHandler channelRegistered 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] REGISTERED 十一月 03, 2019 3:43:10 下午 io.netty.handler.logging.LoggingHandler channelActive 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] ACTIVE channelActive,remoteAddress=/127.0.0.1:63998,eventLoop=io.netty.channel.nio.NioEventLoop@9e7e97c
telnet 发送消息 十一月 03, 2019 3:43:32 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] RECEIVED(7B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 68 65 6c 6c 6f 0d 0a |hello.. | +--------+-------------------------------------------------+----------------+ msg=hello msg.info=class java.lang.String 16进制 0d 0a 对应的10进制 13 10 '\r' 13 '\n' 10 十一月 03, 2019 3:43:32 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] WRITE(6B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 68 65 6c 6c 6f 0a |hello. | +--------+-------------------------------------------------+----------------+ 十一月 03, 2019 3:43:32 下午 io.netty.handler.logging.LoggingHandler flush 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] FLUSH
关闭telnet窗口 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] RECEIVED(27B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| |00000010| 04 04 04 04 04 04 04 04 04 04 04 |........... | +--------+-------------------------------------------------+----------------+ 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler flush 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] FLUSH 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] RECEIVED(51B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| |00000010| 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| |00000020| 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| |00000030| 04 04 04 |... | +--------+-------------------------------------------------+----------------+ 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler flush 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] FLUSH 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler flush 信息: [id: 0x4e0879d4, /127.0.0.1:63998 => /127.0.0.1:6789] FLUSH 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler channelInactive 信息: [id: 0x4e0879d4, /127.0.0.1:63998 :> /127.0.0.1:6789] INACTIVE 十一月 03, 2019 3:43:55 下午 io.netty.handler.logging.LoggingHandler channelUnregistered 信息: [id: 0x4e0879d4, /127.0.0.1:63998 :> /127.0.0.1:6789] UNREGISTERED
发送bye 服务端关闭连接 Telnet 关闭 Connection closed by foreign host. 十一月 03, 2019 3:45:56 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0xfd5b6815, /127.0.0.1:65008 => /127.0.0.1:6789] RECEIVED(5B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 62 79 65 0d 0a |bye.. | +--------+-------------------------------------------------+----------------+ msg=bye十一月 03, 2019 3:45:56 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0xfd5b6815, /127.0.0.1:65008 => /127.0.0.1:6789] WRITE(4B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 62 79 65 0a |bye. | +--------+-------------------------------------------------+----------------+ msg.info=class java.lang.String 十一月 03, 2019 3:45:56 下午 io.netty.handler.logging.LoggingHandler flush 信息: [id: 0xfd5b6815, /127.0.0.1:65008 => /127.0.0.1:6789] FLUSH 十一月 03, 2019 3:45:56 下午 io.netty.handler.logging.LoggingHandler close 信息: [id: 0xfd5b6815, /127.0.0.1:65008 => /127.0.0.1:6789] CLOSE() 十一月 03, 2019 3:45:56 下午 io.netty.handler.logging.LoggingHandler channelInactive 信息: [id: 0xfd5b6815, /127.0.0.1:65008 :> /127.0.0.1:6789] INACTIVE 十一月 03, 2019 3:45:56 下午 io.netty.handler.logging.LoggingHandler channelUnregistered 信息: [id: 0xfd5b6815, /127.0.0.1:65008 :> /127.0.0.1:6789] UNREGISTERED
发送 error 服务端接收到error ,抛异常 十一月 03, 2019 3:53:52 下午 io.netty.handler.logging.LoggingHandler logMessage 信息: [id: 0x6433e073, /127.0.0.1:51324 => /127.0.0.1:6789] RECEIVED(7B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 65 72 72 6f 72 0d 0a |error.. | +--------+-------------------------------------------------+----------------+ msg=error msg.info=class java.lang.String 十一月 03, 2019 3:53:52 下午 io.netty.channel.DefaultChannelPipeline$TailHandler exceptionCaught 警告: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. java.lang.RuntimeException: EchoServerHandler error at dyyx.echo.EchoServerHandler.channelRead(EchoServerHandler.java:29) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:155) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326) at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:283) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) at java.lang.Thread.run(Thread.java:745) 十一月 03, 2019 3:53:52 下午 io.netty.handler.logging.LoggingHandler flush 信息: [id: 0x6433e073, /127.0.0.1:51324 => /127.0.0.1:6789] FLUSH

上一篇     下一篇
URLClassLoader简介

netty配置参数

netty参数及相关代码

性能压测工具

netty线程模型和零拷贝机制

netty组件