Similar questions all seem to be based around using a custom logger, I'm happy to just use the default / none at all. My pika python app runs and receives messages but after a few seconds crashes with No handlers could be found for logger "pika.adapters.blocking_connection"
, any ideas?
import pika
credentials = pika.PlainCredentials('xxx_apphb.com', 'xxx')
parameters = pika.ConnectionParameters('bunny.cloudamqp.com', 5672, 'xxx_apphb.com', credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.queue_declare('messages')
def message_received(channel, method, properties, body):
print "[x] Received %r" % (body)
channel.basic_consume(message_received, queue='messages', no_ack=True)
channel.start_consuming()
Fixed by adding:
import logging
logging.basicConfig()
Fixed by adding:
import logging
logging.basicConfig()
user1733908
There should be exchange name provide, it should not left default.
channel.exchange_declare(exchange='anyname')
来源:https://stackoverflow.com/questions/13517955/no-handlers-could-be-found-for-logger-pika-adapters-blocking-connection