Hi everyone, I'm having a problem with Kedro's log...
# questions
r
Hi everyone, I'm having a problem with Kedro's logging configuration. I developed a Kedro project on my local machine and used this command to use the config/logging.yml file:
Copy code
$env:KEDRO_LOGGING_CONFIG="conf/logging.yml"
And it worked perfectly. However, when I put the project on the server, I did the same thing but this time with the command:
Copy code
export KEDRO_LOGGING_CONFIG=<project path>/conf/logging.yml
in the .bashrc on my server and when I start the service, nothing happens. I can't get the logs or anything at all. I also tried to set the env variable in .env but it still doesn't work. Do you have any idea how to fix this project? Thanks in advance ^^
actually, the project is already on the company server. Previously, I had Kedro version 0.18.6, so I migrated the project to Kedro 19.0.4. After doing this, I no longer have traceability on the loggings.
j
Hey, Are there any specific changes in your logging.yml or settings.py compared to the defaults provided by Kedro 0.19.5? Have you tried setting the KEDRO_LOGGING_CONFIG variable in different environments (e.g., directly in a session, .bashrc, .env) to identify if the issue persists across different setups? Have you checked for any potential conflicts between Kedro and other installed packages that might affect logging? For more details, refer to the Kedro documentation: https://docs.kedro.org/en/stable/starters/new_project_tools.html#custom-logging
r
I don't have a change and the same time I use the documentation of kedro to set all the project but still the same problem
j
In Kedro 0.19, the default location for the logging configuration file has changed to
conf/logging.yml
. This might be the root cause of your issue if your environment variable or configuration is not pointing to the correct location. Also do the logs say "logging file not found" or something like that when you put the wrong path? Please check the above information and let us know if you encounter any specific error messages or issues during your checks. We are continuing to investigate and will get back to you soon.
r
hello, I do the migration of my projet to 0.19.x so my logging is on conf/loggin.yml , and when I execute the export command, All things go as I want and I don't get the error just when I run the projet I had nothing in info.log file
j
Thanks for sharing above information, We are continuing to investigate and will get back to you soon.
❤️ 1
r
@Jitendra Gundaniya thank u, I'm waiting for ur response ^^
n
hello, I do the migration of my projet to 0.19.x so my logging is on conf/loggin.yml , and when I execute the export command, All things go as I want and I don't get the error just when I run the projet I had nothing in info.log file
@Rachid Cherqaoui is it the logging.yml not being read or it's just info.log does not show up as expected?
r
@Nok Lam Chan the logging.yml not being read that's
n
Can you try to use absolute path instead of relative path?
r
I tried but nothing happend
n
Since everything works locally, I think it is working properly in Kedro. Can you tell us more about how to actually set the config, and run the project?
Does this also fails?
Copy code
# Assume you in a terminal and inside kedro project already
export KEDRO_LOGGING_CONFIG=<path>
kedro run
If it's possible, could you insert a script in
settings.py
to make sure the environment variable is actually picked up?
Copy code
# settings.py
import os

print(__file__)
print(os.environ.get("KEDRO_LOGGING_CONFIG", "NO_CONFIG"))
r
the problem that when I execute it on my local windowns It work perfecty but at the server of my company I not work, that's why i'm sure that all it's good with my project, I will try to make it in the settings and I will tell u, I will need to use an .env or not for that ? thank u
n
No, you just add the two line at the top of the file. using .env will not have any effect unless you explicitly load the
.env
yourself.
r
so I will put import os print(os.environ.get("KEDRO_LOGGING_CONFIG", "NO_CONFIG")) in setting.py and after that I will excute export KEDRO_LOGGING_CONFIG=<path> kedro run ?
n
I update the above snippets to
print(___file___)
too so you can also check if the correct path is set
export KEDRO_LOGGING_CONFIG=<path>
You need to somehow set the environment variable. I am not sure what kind of environment/server are you running and it's hard to give you exact instruction
If you have access of a terminal directly, then you can do
export
and
kedro run
r
I realized that I don't have any problems on the terminal, but when I run the project that's hosted on a website, it fails to use the logging.yaml. Do you have any idea about this issue? Otherwise, I'll check with my team's developers to see where the problem is coming from. Thank you for your help