Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96246

Re: Getting response over logging socket

From dieter <dieter@handshake.de>
Subject Re: Getting response over logging socket
Date 2015-09-10 08:54 +0200
References <CACwCsY58KdngvzcRapB0msAYPbJtDubJGKiHtU66nf1GnrRR9A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.310.1441868114.8327.python-list@python.org> (permalink)

Show all headers | View raw


Larry Martell <larry.martell@gmail.com> writes:

> I have an app that uses the logging package with a SocketHandler to
> send messages. Now I've been asked to change it so that it can receive
> a response for each log message sent. It appears there is no way to do
> this with logging package. Is that true?

You are right.


There are different connotations associated with the term "logging".

One connatation is to inform related parties about events of potential
interest in the current execution. The parties may or may not be
interested. It is of no importance for the current execution whether
some party has processed the event. This is the model, the Python
standard handlers adhere to.

Another connatation is used for transaction management. Those
systems often use a sequentially written "log" and some operations
must only proceed after this "log" has definitely been updated.
For this type of "logging", you need a feedback that the logging
operation has completed successfully.

The Python logging targets the first connatation. For the second
connotation, there are likely better approaches than the standard
Python logging framework (look for "transaction", "transactional").


> Can I not receive data over a
> socket used in a logging handler?

Almost surely, you can develop your own logging handler which
performs a handshake with the logging target. Note that
the logging destination, too, will need to be modified for this.

I assume, however, there will be better approaches that using the
Python logging framework -- e.g. transactional safe message queues.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Getting response over logging socket dieter <dieter@handshake.de> - 2015-09-10 08:54 +0200

csiph-web