开发者

Error message 'No handlers could be found for logger "multiprocessing"' using Celery

开发者 https://www.devze.com 2023-03-10 07:23 出处:网络
RabbitMQ now seems to be working correctly. However, when I try python -m celery.bin.celeryd --loglevel=INFO`

RabbitMQ now seems to be working correctly. However, when I try

python -m celery.bin.celeryd --loglevel=INFO` 

(regular celeryd doesn't work), I get the error

No handlers could be found for logger "multiprocessing"`).

Here's the full output (redacted slightly):

[2011-06-06 02:08:08,105: WARNING/MainProcess] -------------- celery@blahblah v2.2.6
---- **** -----
--- * ***  * -- [Configuration]
-- * - **** ---   . b开发者_开发问答roker:      amqplib://blah@localhost:5672/vhost
- ** ----------   . loader:      celery.loaders.default.Loader
- ** ----------   . logfile:     [stderr]@INFO
- ** ----------   . concurrency: 2
- ** ----------   . events:      OFF
- *** --- * ---   . beat:        OFF
-- ******* ----
--- ***** ----- [Queues]
 --------------   . celery:      exchange:celery (direct) binding:celery


[Tasks]
  . tasks.add
[2011-06-06 02:08:08,812: WARNING/MainProcess] celery@blahblah has started
.
No handlers could be found for logger "multiprocessing"
No handlers could be found for logger "multiprocessing"

I'd really like to get this set up properly, so I can move on to using it with Django!

(It is not my first no handlers found error, but I'm having trouble finding anything on the web regarding this...)


You need to ensure that all processes started from the main process also set up logging correctly. Here's a post which discusses how best to do logging with multiprocessing. Though that discusses features with came in with Python 3.2, you can also get this functionality for earlier Python versions - see this other post.

Update: The point is that each process needs to initialise logging, and you need to arrange this in your code, in a similar way to what is done in the example in the first post: see listener_configurer and worker_configurer. You can use logutils to help you, but the main thing is to realise that each process needs to configure logging, if you are to avoid that "no handlers could be found" message.


There seems to be something strange in the way celery initializes logging. If I put the switch --logfile=yourfile.log on the command-line, it works reliably, but reading the logging from the config gives unreliable results including the stuff you're seeing.


Make sure the log file directory exists the and processes has write permission to the log directory.

I faced similar issue , after creating log file location directory the problem went away.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号