BewareMyPower commented on issue #194:
URL: 
https://github.com/apache/pulsar-client-python/issues/194#issuecomment-1892999959

   Here is a workaround to trigger the cleanup (destruction of the objects from 
the C++ library) explicitly.
   
   ```python
   import logging
   
   import pulsar
   
   pulsar_logger = logging.getLogger("pulsarDummyLogger")
   pulsar_logger.setLevel(logging.INFO)
   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()
   del producer
   del client
   ```
   
   Then `producer` and `client` will be destroyed before the Python interceptor 
exits.
   
   ```
   This should be logged
   ...
   [127.0.0.1:52053 -> 127.0.0.1:6650] Destroyed connection to 
pulsar://localhost:6650-0
   Producer - [persistent://public/default/A, standalone-0-7] , [batching  = 
off]
   ```


-- 
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]

Reply via email to