• Netty中的LoggingHandler()


    当添加.addLast("logging", new LoggingHandler(LogLevel.INFO))这行代码时

    Netty就会以给定的日志级别打印出LoggingHandler中的日志。

    可以对入站出站事件进行日志记录,从而方便我们进行问题排查。

    假如现在添加这行代码访问http://127.0.0.1:8007/Action?name=1234510

    19:10:52.089 [nioEventLoopGroup-2-6] INFO io.netty.handler.logging.LoggingHandler - [id: 0x4a9db561, L:/127.0.0.1:8007 - R:/127.0.0.1:53151] REGISTERED
    19:10:52.089 [nioEventLoopGroup-2-6] INFO io.netty.handler.logging.LoggingHandler - [id: 0x4a9db561, L:/127.0.0.1:8007 - R:/127.0.0.1:53151] ACTIVE
    19:10:52.090 [nioEventLoopGroup-2-6] DEBUG com.bihang.seaya.server.handler.SeayaHandler - io.netty.handler.codec.http.DefaultHttpRequest
    19:10:52.090 [nioEventLoopGroup-2-6] DEBUG com.bihang.seaya.server.handler.SeayaHandler - uri/Action?name=1234510
    19:10:52.090 [nioEventLoopGroup-2-6] INFO io.netty.handler.logging.LoggingHandler - [id: 0x4a9db561, L:/127.0.0.1:8007 - R:/127.0.0.1:53151] CLOSE
    19:10:52.090 [nioEventLoopGroup-2-6] INFO io.netty.handler.logging.LoggingHandler - [id: 0x4a9db561, L:/127.0.0.1:8007 ! R:/127.0.0.1:53151] INACTIVE
    19:10:52.090 [nioEventLoopGroup-2-6] INFO io.netty.handler.logging.LoggingHandler - [id: 0x4a9db561, L:/127.0.0.1:8007 ! R:/127.0.0.1:53151] UNREGISTERED
    

    如果没有这行代码的打印信息

    19:15:02.292 [nioEventLoopGroup-2-2] DEBUG com.bihang.seaya.server.handler.SeayaHandler - io.netty.handler.codec.http.DefaultHttpRequest
    19:15:02.292 [nioEventLoopGroup-2-2] DEBUG com.bihang.seaya.server.handler.SeayaHandler - uri/Action?name=1234510
    
  • 相关阅读:
    GDI+中发生一般性错误
    反复
    一些网址
    控制listview大图标之间的间距
    android 系统移植
    android 启动报错
    android init.rc 语法分析
    Linux下的管道编程技术dup函数和dup2函数
    为了防止打开的设备 被占用
    android 多媒体框架
  • 原文地址:https://www.cnblogs.com/bihanghang/p/10170477.html
Copyright © 2020-2023  润新知