Is it a bug?

  • Thread starter Darren Cui Liang
  • Start date
D

Darren Cui Liang

Hi, there!

Now I am working around with the "logging" module. Here is the code:

CRITICAL:root:msg

Since every "logger" is under the "root logger", and if no handler is
found for the logger, the message will be passed to upper level loggers,
until the root,
then why do I get the msg: No handlers could be found for logger "a"

Thanks in advance!

BR
Darren Cui Liang
 
D

Diez B. Roggisch

Darren said:
Hi, there!

Now I am working around with the "logging" module. Here is the code:


CRITICAL:root:msg

Since every "logger" is under the "root logger", and if no handler is
found for the logger, the message will be passed to upper level loggers,
until the root,
then why do I get the msg: No handlers could be found for logger "a"

The error-message is always for the used logger - but it will search the
list of its parents for appropriate handlers. So setting a handler on a
logger foo makes the logger foo.bar find it. Or, alternatively, obtain a
reference tto the root-logger, and set your handler there. Then all
loggers will find it.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,270
Messages
2,571,348
Members
48,034
Latest member
JaimieBarn

Latest Threads

Top