问题描述
我正在使用以下库通过 Java 应用程序连接到我的 Azure 服务总线
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-servicebus</artifactId>
<version>7.2.1</version>
</dependency>
我能够成功连接到服务总线。但是我的控制台充斥着 Azure 消息服务总线日志,我想关闭这些日志
我无法删除项目中的记录器实现,因为其他模块需要它
以下是我收到的示例日志
DEBUG 2021-05-31 10:55:30.184 [reactor.] (): Using Slf4j logging framework
DEBUG 2021-05-31 10:55:30.796 [com.azur] (): connectionId[[id,UNINITIALIZED]]: State {}
INFO 2021-05-31 10:55:30.801 [com.azur] (): namespace[[,host]] entityPath[{}]: Setting next AMQP channel.
INFO 2021-05-31 10:55:30.801 [com.azur] (): namespace[[,host,0]] entityPath[{}]: Next AMQP channel received,updating {} current subscribers
DEBUG 2021-05-31 10:55:30.809 [com.azur] (): connectionId[[id,UNINITIALIZED]]: State {}
INFO 2021-05-31 10:55:30.810 [com.azur] (): # of open clients with shared connection: [1]
Starting the Service Bus processorINFO 2021-05-31 10:55:30.834 [com.azur] (): [Topic name,Subscription name]: Creating consumer for link '{}'
INFO 2021-05-31 10:55:30.839 [com.azur] (): Requesting a new AmqpReceiveLink from upstream.
INFO 2021-05-31 10:55:30.853 [com.azur] (): connectionId[[id,5671]]: Creating and starting connection to {}:{}
如何仅关闭 Azure 服务总线日志?
解决方法
您是否尝试过以下来自 https://github.com/Azure/azure-service-bus-java/issues/255 的建议?
Logger.getLogger("com.microsoft.azure.servicebus").setLevel(Level.OFF);