title: "Protocol wrong type for socket" when using socket.SOCK_STREAM in logging configuration
body: <p>I use <a href="https://docs.python.org/3/library/logging.handlers.html#sysloghandler" rel="nofollow">SysLogHandler</a> in my logging configuration file.</p>
  
  <p>As <code>rsyslog</code> is running on my linux box, I want to use <code>socket.SOCK_STREAM</code> as <code>socktype</code> keyword argument of the <code>SysLogHandler</code> instance. The <a href="https://docs.python.org/3/library/logging.handlers.html#sysloghandler" rel="nofollow">documentation</a> says indeed:</p>
  
  <blockquote>
    <p>To open a TCP socket (for use with the newer syslog daemons such as
    rsyslog), specify a value of socket.SOCK_STREAM.</p>
  </blockquote>
  
  <p>But when I add the handler, like this:</p>
  
  <pre><code>log.addHandler(logging.handlers.SysLogHandler(address='/dev/log',
                                            facility='mathmaker',
                                            socktype=socket.SOCK_STREAM))
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>  File "/home/zezo/dev/myapp/myapp", line 52, in &lt;module&gt;
      socktype=socket.SOCK_STREAM))
    File "/usr/lib/python3.4/logging/handlers.py", line 803, in __init__
      self._connect_unixsocket(address)
    File "/usr/lib/python3.4/logging/handlers.py", line 820, in _connect_unixsocket
      self.socket.connect(address)
  OSError: [Errno 91] Protocol wrong type for socket
  </code></pre>
  
  <p>Though it seems like rsyslog is listening to /dev/log: <code>lsof | grep rsyslog</code> shows:</p>
  
  <pre><code>rsyslogd   8090           syslog    0u     unix 0xffff8800b413ce00      0t0    2739240 /dev/log
  </code></pre>