Hello everyone, I am having a little problem with ...
# questions
l
Hello everyone, I am having a little problem with the logger. I thought I could print out "logger.debug" values by updating the project side logging file (conf/base/logging.yml) console handler level to "DEBUG" but it doesn't seem to change anything? I'm trying to output logs from pipeline nodes.
Copy code
handlers:
    console:
        class: logging.StreamHandler
        level: DEBUG
        formatter: simple
        stream: <ext://sys.stdout>
Copy code
import logging
logger = logging.getLogger(__name__)

def example_node(input):
   logger.debug(input)
   output = input + 1
   return output
I might be just doing something simple wrong but any help be appreciated! It works for info, so just using that for now but would be good to have the option of debug! 🙂
a
Hello @Lawrence Shaban, what do you have under the
loggers
section of your logging.yml file? Chances are that you need to change the
level
there.
l
Hey @Antony Milne, thanks for the response! Do you know which level it is I need to change within logging.yml? I've tried a few... I assumed the console handler (which I put in the original post) seemed most logical but it didn't seem to work?
a
There is a difference between the
handlers
section (the thing you posted above which includes
console
) and the
loggers
section further down the file. Just changing the level of a
handler
won’t show the messages unless the
logger
itself has the level set appropriately. See https://docs.python.org/3/howto/logging.html#logging-flow - the message doesn’t even reach the handler if the logger stops it first 🙂
P.S. what version of kedro are you using? Do you have
rich
in your logging.yml file? This is generally what people use now rather than the plain console logging. It will give you pretty colours and other nice things compared to plain console text.