How to disable logging on the standard error stream?

How to disable logging on the standard error stream in Python? This does not work:

import logging

logger = logging.getLogger()
logger.removeHandler(sys.stderr)
logger.warning('foobar')  # emits 'foobar' on sys.stderr

19 Answers
19

Leave a Comment