类似的问题似乎都根据各地使用自定义记录器,我很高兴能只使用默认的/没有。 我的鼠兔Python应用程序运行和接收消息,但几秒钟后崩溃,并No handlers could be found for logger "pika.adapters.blocking_connection"
,任何想法?
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()
通过添加修正:
import logging
logging.basicConfig()