title: Logging chokes on BlockingIOError: write could not complete without blocking
body: <p>I recently ported my scripts from 2.x to 3.x. During production runs through automation (rundeck) we are seeing errors caused by the logger not handling blocking I/O. Any ideas how to resolve would be great. </p>
  
  <ul>
  <li>Ubuntu 18.04.1 LTS</li>
  <li>Python 3.6.7</li>
  </ul>
  
  <pre><code>--- Logging error ---
  Traceback (most recent call last):
    File "/usr/lib/python3.6/logging/__init__.py", line 998, in emit
      self.flush()
    File "/usr/lib/python3.6/logging/__init__.py", line 978, in flush
      self.stream.flush()
  BlockingIOError: [Errno 11] write could not complete without blocking
  </code></pre>