No handlers could be found for logger “pika.adapters.blocking_connection”

我的梦境 提交于 2019-11-30 01:11:11

问题


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()

回答1:


Fixed by adding:

import logging
logging.basicConfig()



回答2:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!