Skip to content

Commit bff3aea

Browse files
authored
[Event Hubs] [Service Bus] add logging snippet to readme (Azure#19171)
* add logging snippet to readme * add extra lines to snippet
1 parent 8cb17c0 commit bff3aea

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

sdk/eventhub/azure-eventhub/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,18 @@ The Event Hubs APIs generate the following exceptions in azure.eventhub.exceptio
407407
- Enable `azure.eventhub` logger to collect traces from the library.
408408
- Enable `uamqp` logger to collect traces from the underlying uAMQP library.
409409
- Enable AMQP frame level trace by setting `logging_enable=True` when creating the client.
410+
- 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:
411+
```python
412+
import logging
413+
414+
# The logging levels below may need to be adjusted based on the logging that you want to suppress.
415+
uamqp_logger = logging.getLogger('uamqp')
416+
uamqp_logger.setLevel(logging.ERROR)
417+
418+
# or even further fine-grained control, suppressing the warnings in uamqp.connection module
419+
uamqp_connection_logger = logging.getLogger('uamqp.connection')
420+
uamqp_connection_logger.setLevel(logging.ERROR)
421+
```
410422

411423
## Next steps
412424

sdk/servicebus/azure-servicebus/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,18 @@ It would also manifest when trying to take action (such as completing a message)
380380
- Enable `azure.servicebus` logger to collect traces from the library.
381381
- Enable `uamqp` logger to collect traces from the underlying uAMQP library.
382382
- Enable AMQP frame level trace by setting `logging_enable=True` when creating the client.
383+
- 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:
384+
```python
385+
import logging
386+
387+
# The logging levels below may need to be changed based on the logging that you want to suppress.
388+
uamqp_logger = logging.getLogger('uamqp')
389+
uamqp_logger.setLevel(logging.ERROR)
390+
391+
# or even further fine-grained control, suppressing the warnings in uamqp.connection module
392+
uamqp_connection_logger = logging.getLogger('uamqp.connection')
393+
uamqp_connection_logger.setLevel(logging.ERROR)
394+
```
383395

384396
### Timeouts
385397

0 commit comments

Comments
 (0)