Trace 是Rabbitmq用于记录每一次发送的消息,方便使用Rabbitmq的开发者调试、排错。
1、启动Tracing插件
在RabbitMQ中默认是关闭的,需手动开启。此处rabbitMQ是使用docker部署的
## 进入rabbitMq中
docker exec -it rabbitmq1 bash
## 启动日志插件
rabbitmq-plugins enable rabbitmq_tracing
## 开启rabbitmq的tracing插件
rabbitmqctl trace_on
开启了插件后,无需重启,rabbitMq管理界面就会出现Tracing项,可新建追踪。
添加跟踪:
跟踪日志:文章来源:https://www.toymoban.com/news/detail-724093.html
===============================================================================
2023-10-08 8:59:03:528: Message published
Node: rabbit@host-01
Connection: 192.168.49.2:51303 -> 192.168.49.9:5672
Virtual host: /
User: admin
Channel: 1
Exchange: demoDirectExchange
Routing keys: [<<"demoDirectRouting">>]
Routed queues: [<<"demoDirectQueue">>]
Properties: [{<<"priority">>,signedint,0},
{<<"delivery_mode">>,signedint,2},
{<<"headers">>,table,[]},
{<<"content_type">>,longstr,
<<"application/x-java-serialized-object">>}]
Payload:
’
关闭跟踪:文章来源地址https://www.toymoban.com/news/detail-724093.html
# 查看打开的插件
rabbitmq-plugins list
# 关闭trace功能
rabbitmqctl trace_off
# 停止tracing
rabbitmq-plugins disable rabbitmq_tracing
到了这里,关于RabbitMQ开启消息跟踪日志(trace)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!