Logging module: Where are the logs located?

I was reviewing an answer about all logging, it was really helpful. Logging seems to always point back to here.

So it seems I can keep track of things by adding print statements. That’s a fine solution.

However, I built part of my app before discovering Streamlit and when I deploy, I still have code that uses logging.

My question: Where do those logs go? Can I grab them? Are they secure? Thank you!

Welcome to the forum, @johncalculated! Where the logs go depends on how you have set up your logging – you can set it to either write to a file, or write to the console, just like print. If you want those logs to show up in the streamlit log, you should be able to set the logger level value in a .streamlit/config.toml file Configuration - Streamlit Docs

2 Likes

Hey thank you very much! This was super helpful, I’ll dig into it.

@blackary thanks again. Just to be clear, the logs aren’t written anywhere, is that right? The only logging that’s done is to the console, not to a file.

Thank you! John

Correct. You could change your config to also/instead write them to a file, but if you’re hosting your app on Community Cloud, those log files would not necessarily exist long-term.

1 Like