I am trying to do logging from multi page app.
I have run the Home .py like this
python -m streamlit run Home_v1.py --logger.level=warning 2>‘app_log.log’
In the above page the logging is happening fine.
Here is the code in the Home.py
Then i have a childpage.py where i have used the logging same code for testing
but when i click on the child page and it comes up logging does not seem to be happening from the child page. Any suggestions or advise appreciated.
Thanks
Sai
I haven’t tried your solution, but I once created a little script that allows me to log in to any page of a multipage app.
Here it is below:
import streamlit as st
# Hardcoded password
correct_password = "one"
def check_password():
"""Returns `True` if the user has the correct password."""
# Initialize 'password_correct' if it's not in the session state
if "password_correct" not in st.session_state:
st.session_state["password_correct"] = False
# If the password has already been entered correctly, don't ask again
if st.session_state.password_correct:
return True
# Initialize 'password' if it's not in the session state
if "password" not in st.session_state:
st.session_state["password"] = ""
def password_entered():
"""Checks whether a password entered by the user is correct."""
if st.session_state.password == correct_password:
st.session_state.password_correct = True
else:
st.session_state.password_correct = False
# Password not correct, show input + error.
st.text_input(
"Please authenticate to access the pages",
type="password",
on_change=password_entered,
key="password",
)
if st.session_state.password_correct:
return True
elif st.session_state.password:
st.error("😕 Password incorrect")
return False
Thanks Charlie for your response. But i am talking about logger logging not authentication log in… i think your script refers to authentication login… please correct me… Thank you again…
Sai
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.