Close the socket with linger=100 when deleting a ZeroMQHandler

Without this change, a ZeroMQHandler not able to reach the
subscriber will hang indefinitely when deleted. This is due
to the 'ZMQ_LINGER' option which by defaut tells ZeroMQ to
 wait for every pending message to be sent before terminating
a context, without any limit in time.

We limit this pending time to 100ms.
Merge pull request #124 from onitu/zmqhandler_exit

Close the socket with linger=100 when deleting a ZeroMQHandler
Fixing a deadlock in handlers

format_and_encode was called under a lock,
but it may trigger a deadlock if during the repr() or str()
another call to logging is emitted
to fix this, we had to separate format_and_encode into separate methods,
format, and encode, so the formatting would be done outside the lock
and the encoding (which uses the stream's encoding) would be done inside
the lock.

We added a test that re-creates the deadlock without the fix.
Removing the deprecated RotatingFileHandlerBase
Fixing thread-safety issues in file-based handlers

Not all file-related operations were under a lock, now they are.
Merge pull request #125 from grzn/master

Fixing deadlock and thread-safety issues in handlers