Add the ability to mute/disable messages logged by the Logger

Open
#11,645 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start in logger.py and trace how the repeated app_session messages are emitted, using the example ScriptRunnerEvent.ENQUEUE_FORWARD_MSG as the case to understand. Define what a global suppression filter should cover and verify that selected messages are muted without hiding unrelated logs; the issue names no test file, so add or locate coverage for this behavior.

Written by the indexing model from the issue text.

Description

area:backend type:enhancement
Checklist
  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.
Summary

My team has created an API in Streamlit that makes many streamlit calls with no actually user loading up a web browser. I get thousands of messages that show this:

2025-06-13 05:56:58.507:streamlit.runtime.app_session:app_session.py:525:DEBUG: Ignoring event from non-current ScriptRunner: ScriptRunnerEvent.ENQUEUE_FORWARD_MSG
2025-06-13 05:56:58.508:streamlit.runtime.app_session:app_session.py:525:DEBUG: Ignoring event from non-current ScriptRunner: ScriptRunnerEvent.ENQUEUE_FORWARD_MSG

My feature request is looking to add a function that applies a Global Filter to log message. Similar to how urllib3 has a disable warnings function.
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

Why?

I'm an unable to easily debug my streamlit application when I get over 2000+ messages repeating the same message. I'd like a way to add a filter so that if the user wants, they can disable certain messages from being logged.

How?

I'd like to introduce a function inside logger.py that adds a Global Filter to loggers.
I wanted to see if this was possible, and I have already created working code for this. Ideally, I'd like this feature to get added and would love feedback from Streamlit team if the team decided this is a good feature.

My current code would look like this when added to a streamlit python file.

from streamlit.logger import suppress_log_event
from streamlit.runtime.scriptrunner import ScriptRunnerEvent

suppress_log_event(ScriptRunnerEvent.ENQUEUE_FORWARD_MSG)
Additional Context

I'd like to volunteer for the solution for this issue.

Dominant language
Python
Stars
45.8k
Forks
4.4k
Avg merge
21h 22m
Merged PRs (30d)
316

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from streamlit/streamlit

All issues in streamlit/streamlit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.