I am using the logging module in python as: import logging, sys logger = logging.getLogger(__file__) logging.basicConfig( stream=sys.stderr, level=logging.DEBUG, format='%(filename)s:%(lineno)s %(levelname)s:%(message)s') logger.debug("Hello World") Now, after I have set the basic configuration, I want to have a command line argument that can change the output stream from sys.stderr to a file. I have read the doc and it says that if both filename and stream are present at the same time, the stream is ignored. How do I change the stream to a file after I have already done the basicConfig? Continue reading...