zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    PLL详解
    CSI-2 协议
    C语言volatile关键字的用法
    联合体(union)的使用方法及其本质
    Linux驱动之LED驱动编写
    insmod 和第一个驱动
    黑电平校正BLC
    什么是HDR?
    使用starUML画顺序图
    UML 资料整理
  • 原文地址:https://www.cnblogs.com/bihanghang/p/10170477.html
Copyright © 2011-2022 走看看