No handlers could be found for logger "pika.adapters.blocking_connection"

Mim Hufford picture Mim Hufford · Nov 22, 2012 · Viewed 7.9k times · Source

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

Answer

Mim Hufford picture Mim Hufford · Nov 22, 2012

Fixed by adding:

import logging
logging.basicConfig()