Closed veebs closed 10 years ago
Add pipeline.addLast("log", new LoggingHandler())
into PipelineFactory class if WebServerConfig field logNetworkActivity flag is set to true.
WebServerConfig
logNetworkActivity
true
This will output the HTTP requests and responses to the log when the log level is set to DEBUG.
15:42:47.773 [DEBUG] [nioEventLoopGroup-3-1] [] [i.n.handler.logging.LoggingHandler] [] - [id: 0x67a307ff, /127.0.0.1:47756 => /127.0.0.1:9002] RECEIVED(255B) +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 47 45 54 20 2f 77 65 62 73 6f 63 6b 65 74 2f 73 |GET /websocket/s| |00000010| 75 62 70 72 6f 74 6f 63 6f 6c 73 2f 20 48 54 54 |ubprotocols/ HTT| |00000020| 50 2f 31 2e 31 0d 0a 55 70 67 72 61 64 65 3a 20 |P/1.1..Upgrade: | |00000030| 77 65 62 73 6f 63 6b 65 74 0d 0a 43 6f 6e 6e 65 |websocket..Conne| |00000040| 63 74 69 6f 6e 3a 20 55 70 67 72 61 64 65 0d 0a |ction: Upgrade..| |00000050| 53 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d 4b 65 |Sec-WebSocket-Ke| |00000060| 79 3a 20 4a 36 38 5a 51 63 67 36 4c 42 43 59 70 |y: J68ZQcg6LBCYp| |00000070| 6e 52 54 45 30 6f 38 64 77 3d 3d 0d 0a 48 6f 73 |nRTE0o8dw==..Hos| |00000080| 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a 39 30 30 |t: localhost:900| |00000090| 32 0d 0a 53 65 63 2d 57 65 62 53 6f 63 6b 65 74 |2..Sec-WebSocket| |000000a0| 2d 4f 72 69 67 69 6e 3a 20 68 74 74 70 3a 2f 2f |-Origin: http://| |000000b0| 6c 6f 63 61 6c 68 6f 73 74 3a 39 30 30 32 0d 0a |localhost:9002..| |000000c0| 53 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d 50 72 |Sec-WebSocket-Pr| |000000d0| 6f 74 6f 63 6f 6c 3a 20 64 6f 6e 74 6b 6e 6f 77 |otocol: dontknow| |000000e0| 0d 0a 53 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d |..Sec-WebSocket-| |000000f0| 56 65 72 73 69 6f 6e 3a 20 31 33 0d 0a 0d 0a |Version: 13.... | +--------+-------------------------------------------------+----------------+
Add pipeline.addLast("log", new LoggingHandler())
into PipelineFactory class if
WebServerConfig
fieldlogNetworkActivity
flag is set totrue
.This will output the HTTP requests and responses to the log when the log level is set to DEBUG.