From bff3aea62587c1685cbbacc3c53dbb7637b5ba29 Mon Sep 17 00:00:00 2001 From: swathipil <76007337+swathipil@users.noreply.github.com> Date: Fri, 25 Jun 2021 11:55:17 -0700 Subject: [PATCH] [Event Hubs] [Service Bus] add logging snippet to readme (#19171) * add logging snippet to readme * add extra lines to snippet --- sdk/eventhub/azure-eventhub/README.md | 12 ++++++++++++ sdk/servicebus/azure-servicebus/README.md | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/sdk/eventhub/azure-eventhub/README.md b/sdk/eventhub/azure-eventhub/README.md index 5affdf7bfc52..5c1b0e290947 100644 --- a/sdk/eventhub/azure-eventhub/README.md +++ b/sdk/eventhub/azure-eventhub/README.md @@ -407,6 +407,18 @@ The Event Hubs APIs generate the following exceptions in azure.eventhub.exceptio - Enable `azure.eventhub` logger to collect traces from the library. - Enable `uamqp` logger to collect traces from the underlying uAMQP library. - Enable AMQP frame level trace by setting `logging_enable=True` when creating the client. +- There may be cases where you consider the `uamqp` logging to be too verbose. To suppress unnecessary logging, add the following snippet to the top of your code: +```python +import logging + +# The logging levels below may need to be adjusted based on the logging that you want to suppress. +uamqp_logger = logging.getLogger('uamqp') +uamqp_logger.setLevel(logging.ERROR) + +# or even further fine-grained control, suppressing the warnings in uamqp.connection module +uamqp_connection_logger = logging.getLogger('uamqp.connection') +uamqp_connection_logger.setLevel(logging.ERROR) +``` ## Next steps diff --git a/sdk/servicebus/azure-servicebus/README.md b/sdk/servicebus/azure-servicebus/README.md index 8d2bec0ba91f..ee54f9b04819 100644 --- a/sdk/servicebus/azure-servicebus/README.md +++ b/sdk/servicebus/azure-servicebus/README.md @@ -380,6 +380,18 @@ It would also manifest when trying to take action (such as completing a message) - Enable `azure.servicebus` logger to collect traces from the library. - Enable `uamqp` logger to collect traces from the underlying uAMQP library. - Enable AMQP frame level trace by setting `logging_enable=True` when creating the client. +- There may be cases where you consider the `uamqp` logging to be too verbose. To suppress unnecessary logging, add the following snippet to the top of your code: +```python +import logging + +# The logging levels below may need to be changed based on the logging that you want to suppress. +uamqp_logger = logging.getLogger('uamqp') +uamqp_logger.setLevel(logging.ERROR) + +# or even further fine-grained control, suppressing the warnings in uamqp.connection module +uamqp_connection_logger = logging.getLogger('uamqp.connection') +uamqp_connection_logger.setLevel(logging.ERROR) +``` ### Timeouts