FAQ
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? Can I not receive data over a
socket used in a logging handler?

Search Discussions

  • Dieter at Sep 10, 2015 at 6:54 am

    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 9, '15 at 10:37a
activeSep 10, '15 at 6:54a
posts2
users2
websitepython.org

2 users in discussion

Dieter: 1 post Larry Martell: 1 post

People

Translate

site design / logo © 2019 Grokbase