gpt4 book ai didi

python - 找不到记录器 "pika.adapters.blocking_connection"的处理程序

转载 作者:太空狗 更新时间:2023-10-29 17:02:15 24 4
gpt4 key购买 nike

类似的问题似乎都基于使用自定义记录器,我很乐意只使用默认值/根本不使用。我的 pika 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()

最佳答案

通过添加修复:

import logging
logging.basicConfig()

关于python - 找不到记录器 "pika.adapters.blocking_connection"的处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13517955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com