Skip to content

Commit 558547c

Browse files
authored
Update README.md (#33622)
1 parent 61132d6 commit 558547c

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

sdk/servicebus/azure-servicebus/README.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,19 +388,22 @@ It would also manifest when trying to take action (such as completing a message)
388388
### Logging
389389

390390
- Enable `azure.servicebus` logger to collect traces from the library.
391-
- Enable `uamqp` logger to collect traces from the underlying uAMQP library.
392391
- Enable AMQP frame level trace by setting `logging_enable=True` when creating the client.
393-
- 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:
392+
394393
```python
395394
import logging
395+
import sys
396396

397-
# The logging levels below may need to be changed based on the logging that you want to suppress.
398-
uamqp_logger = logging.getLogger('uamqp')
399-
uamqp_logger.setLevel(logging.ERROR)
397+
handler = logging.StreamHandler(stream=sys.stdout)
398+
logger = logging.getLogger('azure.servicebus')
399+
logger.setLevel(logging.DEBUG)
400+
logger.addHandler(handler)
400401

401-
# or even further fine-grained control, suppressing the warnings in uamqp.connection module
402-
uamqp_connection_logger = logging.getLogger('uamqp.connection')
403-
uamqp_connection_logger.setLevel(logging.ERROR)
402+
...
403+
404+
from azure.servicebus import ServiceBusClient
405+
406+
client = ServiceBusClient(..., logging_enable=True)
404407
```
405408

406409
### Timeouts
@@ -506,6 +509,34 @@ client = ServiceBusClient.from_connection_string(
506509
Note: The `message` attribute on `ServiceBusMessage`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`, has been deprecated.
507510
The "Legacy" objects returned by `message` attribute have been introduced to help facilitate the transition.
508511

512+
To enable the `uamqp` logger to collect traces from the underlying uAMQP library:
513+
```python
514+
import logging
515+
516+
uamqp_logger = logging.getLogger('uamqp')
517+
uamqp_logger.setLevel(logging.DEBUG)
518+
uamqp_logger.addHandler(handler)
519+
520+
...
521+
522+
from azure.servicebus import ServiceBusClient
523+
524+
client = ServiceBusClient(..., logging_enable=True)
525+
```
526+
527+
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:
528+
```python
529+
import logging
530+
531+
# The logging levels below may need to be changed based on the logging that you want to suppress.
532+
uamqp_logger = logging.getLogger('uamqp')
533+
uamqp_logger.setLevel(logging.ERROR)
534+
535+
# or even further fine-grained control, suppressing the warnings in uamqp.connection module
536+
uamqp_connection_logger = logging.getLogger('uamqp.connection')
537+
uamqp_connection_logger.setLevel(logging.ERROR)
538+
```
539+
509540
### Building uAMQP wheel from source
510541

511542
`azure-servicebus` depends on the [uAMQP](https://pypi.org/project/uamqp/) for the AMQP protocol implementation.

0 commit comments

Comments
 (0)