Larry Martell <larry.mart...@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.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to