Samreay opened a new issue, #194:
URL: https://github.com/apache/pulsar-client-python/issues/194
There is an option to pass in a Logger when creating the pulsar client to
log to. It seems this does not work.
# Reproduction:
First, run a pulsar standalone instance:
```bash
docker run -it -p 6650:6650 -p 8080:8080 --tmpfs /pulsar/data
apachepulsar/pulsar:3.1.0 bin/pulsar standalone
```
And then run this code:
```python
import logging
import pulsar
pulsar_logger = logging.getLogger("pulsarDummyLogger")
pulsar_logger.setLevel(logging.ERROR)
logging.basicConfig(level=logging.INFO, format="{message}", style="{")
logging.info("This should be logged")
pulsar_logger.info("This isn't logged (correctly)")
client = pulsar.Client("pulsar://localhost:6650", logger=pulsar_logger)
producer = client.create_producer("A")
producer.close()
client.close()
```
It will write this to your terminal:
```bash
This should be logged
2024-01-15 14:12:08.947 DEBUG [140254733069184] ProducerImpl:128 |
[persistent://public/default/A, standalone-0-4] ~ProducerImpl
2024-01-15 14:12:08.948 INFO [140254733069184] ProducerImpl:722 | Producer
- [persistent://public/default/A, standalone-0-4] , [batching = off]
```
Potentially related to https://github.com/apache/pulsar/pull/7713
# Expected behaviour
We can control the formatting and level of the logs produced by the pulsar
client.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]