I run streamlit app in deployed server (AWS), and I added the log file for checking user’s activity like login, file-upload, and download.
But it captures multiple log like below.
The same activity is accumulating multiple times in my log csv file and the logs are off by a few seconds even if I login just one time.
Is this the problem of the pages what I made? Since I made the pages for login and main page for translation and after user login, it goes to the main app page, so I wonder that it captures login multiple time.
from utils.csv_logger import CSVLogger
csvlogger = CSVLogger("log.csv")
if st.session_state["authentication_status"]:
csvlogger.log(st.session_state["username"], 'login', '1','')
logger.warning(f'User {st.session_state["username"]} has logged in.')
app.main()
st.sidebar.markdown(f"###### Currently logged in as: {st.session_state['name']}")
elif st.session_state["authentication_status"] is False:
st.error('Wrong ID or Password. Please log in again.')
logger.error(f'User {st.session_state["username"]} failed to log in.')
csvlogger.log(st.session_state["username"], 'login', '0','')
My environment is
- Streamlit version 1.21.0
- Python 3.10