title: how to make streamHandler overwrite every time
body: <p>I hope to overwrite the previous logging every time I run the application. I figure it out for FileHandler by specifying file mode being 'w'. Where can I specify similar behaviour for StreamHandler? Consider the following code, if running multiple times, 'test.log' will always show a single line of 'test' while the console will show multiple lines of 'test'. </p>
  
  <p>I tried the flush method but it doesn't work.</p>
  
  <pre><code>import logging
  
  logger = logging.getLogger(__name__)
  logger.setLevel(logging.INFO)
  
  file_handler = logging.FileHandler('test.log', mode = 'w')
  logger.addHandler(file_handler)
  
  streamHandler = logging.StreamHandler()
  logger.addHandler(streamHandler)
  
  logger.info('test')
  </code></pre>
  
  <p>I hope the console will show a single line of 'test' even if running multiple times.</p>