找不到用于记录程序"pika.adapters.blocking_connection"的处理程序. [英] No handlers could be found for logger "pika.adapters.blocking_connection"

查看:170
本文介绍了找不到用于记录程序"pika.adapters.blocking_connection"的处理程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似的问题似乎都是基于使用自定义记录器的,我很高兴只使用默认值/根本不使用.我的pika python应用程序运行并接收消息,但几秒钟后由于No handlers could be found for logger "pika.adapters.blocking_connection"崩溃,有任何想法吗?

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

这篇关于找不到用于记录程序"pika.adapters.blocking_connection"的处理程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆