logging.handlers.SocketHandler

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Mar 9 10:32:31 EDT 2009


On Mar 9, 2:10 pm, writeson <doug.farr... at gmail.com> wrote:
> My manager is suggesting that the underlying problem is using TCP
> rather than UDP (SocketHandler vs DatagramHandler) forloggingfrom
> clients to theloggingserver. His assertion is that using TCP would
> guarantee the loss of 2 messages at theloggingserver from an
> attached daemon before a reconnect was established. I don't know
> enough about network protocols to determine if this is true or not,
> but the reading I've done about UDP talks about UDP being an
> unreliable protocol, so I'm not sure how using it would change the
> loss of 2 or more messages while a reconnect occurs. Perhaps because
> it is stateless and doesn't have to re-establish a connection? I'm not
> sure, what are your thoughts?

UDP makes no guarantees about delivery or ordering of packets which
are delivered, so moving to UDP could mean that you lose packets even
when the server is always up. If a server has been brought down and
restarted, a number of messages (typically more than 2) will have been
lost during the period of unavailability of the server, so I am not
sure why the loss of some messages during server start-up cannot be
tolerated. If it is important not to lose messages, then you will
probably have to use some other handler which buffers log events and
uses an always-up store-and-forward mechanism to guarantee delivery
across periods of downtime.

Regards,

Vinay Sajip



More information about the Python-list mailing list