From dad9f4dd30b6641ccdd1329a727797baa03e2c0b Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Tue, 8 Jun 2021 14:18:39 -0700 Subject: [PATCH 1/2] add logging snippet to readme --- sdk/eventhub/azure-eventhub/README.md | 8 ++++++++ sdk/servicebus/azure-servicebus/README.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sdk/eventhub/azure-eventhub/README.md b/sdk/eventhub/azure-eventhub/README.md index 6dcd3a3ef3d5..6c9fe3fbe2b9 100644 --- a/sdk/eventhub/azure-eventhub/README.md +++ b/sdk/eventhub/azure-eventhub/README.md @@ -407,6 +407,14 @@ 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 +uamqp_logger = logging.getLogger('uamqp') +# The logging levels below may need to be changed based on the logging that you want to suppress. +logging.basicConfig(level=logging.WARNING) +uamqp_logger.setLevel(logging.ERROR) +``` ## Next steps diff --git a/sdk/servicebus/azure-servicebus/README.md b/sdk/servicebus/azure-servicebus/README.md index 2318a73e422e..9ec83a5fcead 100644 --- a/sdk/servicebus/azure-servicebus/README.md +++ b/sdk/servicebus/azure-servicebus/README.md @@ -380,6 +380,14 @@ 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 +uamqp_logger = logging.getLogger('uamqp') +# The logging levels below may need to be changed based on the logging that you want to suppress. +logging.basicConfig(level=logging.WARNING) +uamqp_logger.setLevel(logging.ERROR) +``` ### Timeouts From 243a4655c54b63871108c266f39dd653bab9cbbd Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Tue, 8 Jun 2021 14:30:30 -0700 Subject: [PATCH 2/2] add extra lines to snippet --- sdk/eventhub/azure-eventhub/README.md | 8 ++++++-- sdk/servicebus/azure-servicebus/README.md | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/README.md b/sdk/eventhub/azure-eventhub/README.md index 6c9fe3fbe2b9..bef7bdbf373c 100644 --- a/sdk/eventhub/azure-eventhub/README.md +++ b/sdk/eventhub/azure-eventhub/README.md @@ -410,10 +410,14 @@ The Event Hubs APIs generate the following exceptions in azure.eventhub.exceptio - 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') -# The logging levels below may need to be changed based on the logging that you want to suppress. -logging.basicConfig(level=logging.WARNING) 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 9ec83a5fcead..daa7d2ee3124 100644 --- a/sdk/servicebus/azure-servicebus/README.md +++ b/sdk/servicebus/azure-servicebus/README.md @@ -383,10 +383,14 @@ It would also manifest when trying to take action (such as completing a message) - 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 -uamqp_logger = logging.getLogger('uamqp') + # The logging levels below may need to be changed based on the logging that you want to suppress. -logging.basicConfig(level=logging.WARNING) +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