Logs are not printing on community cloud

Hi. I have created my Streamlit app on the community cloud and it is not properly printing the logs. I know that I can view the log by clicking on the ‘Manage App’ on the bottom right and I can view/download the logs. However the logs don’t appear to be properly printing out the information. Sometimes it prints but most of the time it does not. If I run the program hosted locally I can see that everything prints correctly.

Basically I have some print statements in the code that I want to be able to see when I view the log. This both has some information about what features of the application are being used as well as some relevant data that would help debugging.

To my understanding, when a different user used the program, their work should also be included in the logs, however it does not appear as if this is the case. (however even when I am doing this it is not show in in the log)

Also as a side note, is there a way to delete the log if it gets very long and I do not want to deal with the long string when I download it?

Thanks for the help!

Hey @bprato2,

Thanks for sharing this question! Is the main issue that the print statements you mentioned aren’t appearing in the log? If so, can you share a code snippet that includes an example of those print statements?

Thanks for the response!

Yeah the main issue is that the print statements do not appear in the log most of the time.

Here is a snippet of my code.

uploaded_file = st.file_uploader("Please upload a file.")
if uploaded_file is not None:
    print(f'Routing Program run time: {datetime.datetime.now()}')

Here I am asking the user to upload a file, and then if the file is uploaded I want it to print out in the log the when the program was ran. If I run it locally it works, and it occasionally works when running on the community cloud but it is very inconsistent. I want to be able to see when the program is being utilized and which of the functions are being used (this is just one function but for each of the different functions of my program I have a different print statement)

Have you set a logging level via your config.toml file?

I have not done that and am not vary familiar with it. I have done a little digging and I do not see a config.toml file but I do see in the code there is venv → Lib\site-packages → absl → logging which I assume it is related to that. I am relatively new to coding so I am still getting affiliated with the ins and outs of it.

I will continue to do more research to determine how to set my logging level via the config.toml file and figure out what configuration would make this work. I greatly appreciate your help and when I’m able to do the dive into figuring this out I will be sure to come back here to let you know if there were any other road blocks/if it worked

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.