hey everyone, I have a problem with kedro logging...
# questions
f
hey everyone, I have a problem with kedro logging. (conf/logging.yml)
Copy code
# To enable this custom logging configuration, set KEDRO_LOGGING_CONFIG to the path of this file.
# More information available at <https://docs.kedro.org/en/stable/logging/logging.html>
version: 1

disable_existing_loggers: False

formatters:
  simple:
    format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"

handlers:
  console:
    class: logging.StreamHandler
    level: INFO
    formatter: simple
    stream: <ext://sys.stdout>

  info_file_handler:
    class: logging.handlers.RotatingFileHandler
    level: INFO
    formatter: simple
    filename: info.log
    maxBytes: 10485760 # 10MB
    backupCount: 20
    encoding: utf8
    delay: True

  rich:
    class: kedro.logging.RichHandler
    rich_tracebacks: True
    # Advance options for customisation.
    # See <https://docs.kedro.org/en/stable/logging/logging.html#project-side-logging-configuration>
    # tracebacks_show_locals: False

loggers:
  kedro:
    level: INFO

  text2shots:
    level: INFO

root:
  handlers: [rich]
According to documentation, unless i define the
KEDRO_LOGGING_CONFIG
the default will be used (which points to here: https://github.com/kedro-org/kedro/blob/main/kedro/framework/project/default_logging.yml) 1- When i run kedro, i see the logging saying it will use my file by default (it picks it up automatically which is fine) 2- When my code fails, i can't see the tracebacks properly. After some hours spent, i found the issue (which is the full traceback):
Copy code
File "/home/ftopal/Projects/text2shots/.venv/lib/python3.11/site-packages/lmapis/providers/anthropic.py", line 103, in convert_messages
    converted_messages = [_convert_single_message(msg) for msg in messages]
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ftopal/Projects/text2shots/.venv/lib/python3.11/site-packages/lmapis/providers/anthropic.py", line 103, in <listcomp>
    converted_messages = [_convert_single_message(msg) for msg in messages]
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ftopal/Projects/text2shots/.venv/lib/python3.11/site-packages/lmapis/providers/anthropic.py", line 65, in _convert_single_message
    for tool_call in msg["tool_calls"]:
TypeError: 'NoneType' object is not iterable
but kedro only shows the last part to me
TypeError: 'NoneType' object is not iterable
and does not even mention the file/line number so it's incredibly hard for me to understand where this is coming from. I am using kedro version: 0.19.12. How can i enable this so i get full error tracebacks without losing them?
j
Hey Fazil, Try updating config in
logging.yml
Copy code
tracebacks_show_locals: True

root:
  handlers: [rich, console]
f
Hey @Jitendra Gundaniya thanks, do i need env variable setup or will it pick up my file by default? Right now my deployment does not have the logging config env set
j
Kedro will pick up your
conf/logging.yml
file automatically by default, no environment variable needed.
👍 1
f
hey @Jitendra Gundaniya, Coming back to this
Copy code
tracebacks_show_locals: True

root:
  handlers: [rich]
This is what i did and it works fine locally. Somehow this does not work on the cloud (aws lambda) any clue about that? Not sure if it's kedro related or the rich logging itself 😅