如果我启用调试日志记录并使用以下配置,我将在控制台上获得某种十六进制转储:
HttpClient.create().wiretap(true);
演出:
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 49 70 73 6f 20 66 61 63 74 6f 20 69 73 20 61 20 |Ipso facto is a |
|00000010| 4c 61 74 69 6e 20 70 68 72 61 73 65 2c 20 64 69 |Latin phrase, di|
|00000020| 72 65 63 74 6c 79 20 74 72 61 6e 73 6c 61 74 65 |rectly translate|
|00000030| 64 20 61 73 20 22 62 79 20 74 68 65 20 66 61 63 |d as "by the fac|
|00000040| 74 20 69 74 73 65 6c 66 22 2c 5b 31 5d 20 77 68 |t itself",[1] wh|
|00000050| 69 63 68 20 6d 65 61 6e 73 20 74 68 61 74 20 61 |ich means that a|
|00000060| 20 73 70 65 63 69 66 69 63 20 70 68 65 6e 6f 6d | specific phenom|
|00000070| 65 6e 6f 6e 20 69 73 20 61 20 64 69 72 65 63 74 |enon is a direct|
|00000080| 20 63 6f 6e 73 65 71 75 65 6e 63 65 2c 20 61 20 | consequence, a |
|00000090| 72 65 73 75 6c 74 61 6e 74 20 65 66 66 65 63 74 |resultant effect|
问题:如何告诉 netty 将十六进制转储转换为纯字符串(例如,这样我只能看到真正的 json 输出)?
尤其是消息正文被压缩,我想以未压缩的方式记录它。但如何呢?
请您参考如下方法:
HttpClient httpClient = HttpClient
.create()
.wiretap("reactor.netty.http.client.HttpClient",
LogLevel.DEBUG, AdvancedByteBufFormat.TEXTUAL);
这应该只为您提供所需的文本