I found a solution for this:
logger = logging.getLogger('my-logger')
logger.propagate = False
# now if you use logger it will not log to console.
This will prevent logging from being send to the upper logger that includes the console logging.
More Related Contents:
- logger configuration to log to file and print to stdout
- How to redirect stdout and stderr to logger in Python
- How to write custom python logging handler?
- How to make print() output UTF-8 in Python 3.0?
- Redirect Python ‘print’ output to Logger
- String formatting: % vs. .format vs. f-string literal
- Text progress bar in terminal with block characters [closed]
- multiple prints on the same line in Python
- Can I redirect the stdout into some sort of string buffer?
- Rewrite multiple lines in the console
- Log all requests from the python-requests module
- Is there go up line character? (Opposite of \n)
- Getting console.log output from Chrome with Selenium Python API bindings
- Python 2.x – Write binary output to stdout?
- How to add a custom loglevel to Python’s logging facility
- Running powershell script within python script, how to make python print the powershell output while it is running
- How do I add custom field to Python log format string?
- Get output from a Paramiko SSH exec_command continuously
- using Python logger class to generate multiple logs for different log levels
- How can the terminal output of executables run by Python functions be silenced in a general way?
- Get Output From the logging Module in IPython Notebook
- logging with filters
- How do I detect whether sys.stdout is attached to terminal or not? [duplicate]
- How can I print multiple things on the same line, one at a time?
- How can I disable logging while running unit tests in Python Django?
- How do I get my FastAPI application’s console log in JSON format with a different structure and different fields?
- Deadlock with logging multiprocess/multithread python script
- How do I log from my Python Spark script
- Naming Python loggers
- Can structured logging be done with Pythons standard library?