logging via SocketHandler and TCPserver
Larry Bates
larry.bates at websafe.com`
Tue Jul 15 10:21:29 EDT 2008
Vinay Sajip wrote:
> On Jul 14, 11:16 pm, Larry Bates <larry.ba... at websafe.com`> wrote:
>> Vinay,
>>
>> Thanks for your detailed explanation, but IMHO your suggested solution is almost
>> the opposite (right idea wrong direction) of what I'm looking for. Hypothetical
>> setup:
>>
>> application1 - SocketHandlerloggingturned on
>> application2 - SocketHandlerloggingturned on
>> application3 - SocketHandlerloggingturned on
>> .
>> .
>> .
>> applicationN
>>
>> monitoring app - ThreadingTCPServer target that Allows user to connect to ANY
>> running application and to view the real-time log messages. After monitoring,
>> it should be able to disconnect and connect to another application... The
>> clients (application1..N) never stop sending and don't ever send anything short
>> to disconnect themselves from the monitoring application. The disconnect/
>> reconnect is done at the monitoring app end based on input from the user. I
>> think each one would beloggingto a different port, but I never really quite
>> got that far. Perhaps there is some other way that I'm missing. It seems like
>> this is something that might be able to be "generalized" into a robust
>> monitoring application for an arbitrary number of asynchronously running
>> applications.
>>
>> Each application's real-time log might be reached by clicking on a tab, menu, etc.
>
> Here's how I see it: the socket server listens, and receives logging
> events from numerous applications in real time. If the server is
> configured to monitor app1, then it quietly discards (or doesn't show
> in the UI) all events from other apps - it only collects/shows events
> from app1. When you click on a tab/menu/whatever to switch to
> monitoring app2, then this information is used to tell the server to
> discard (or not show) events from all apps except app2. You would of
> course need to ensure the communication between UI thread and server
> thread were done in a thread-safe manner.
>
>> As to the difficulty, I might just have a mental block but two modules that I've
>> had a real hard time getting my mind wrapped around is yourLoggingand Twisted.
>> They both have a multitude of options/ways to be used and not very many working
>> examples to work from. Might be a chance to make some money on a book. If it
>> was full of examples, I'd purchase it.
>>
>
> But there are numerous examples in the logging docs - the script you
> quoted as having put together after several hours of Googling is
> pretty much the same as the (working) version in the logging docs! If
> you have reviewed the logging docs and find them lacking examples,
> please provide more detail about the kind of examples you think are
> missing. And I can't speak for Twisted, but it does a lot more than
> logging - and I don't think there's enough complexity in Python
> logging to warrant a paid-for book. (No doubt people will tell me if
> they disagree!)
>
> Best regards,
>
> Vinay Sajip
Can multiple applications send SocketHandler logging records to the same socket
server on the same port simultaneously? If so, then I understand your answer
completely and will go in that direction. I guess I was trying to not use up
bandwidth/CPU cycles on the applications that weren't being actively monitored
by just not having the socket server connected to them.
I think you may be a 'little to close' to the (excellent) application you have
written to understand the steep learning curve that I see. You know the saying,
"Brain surgery is easy to a brain surgeon". I should point out that I'm no
newbie. I've used PIL, ReportLab, BeautifulSoup, Mechanize, Win32 extensions,
ElementTree and a whole host of other modules with less difficulty. Please
don't take this as anything more than an observation on my part. From what I
see, you have written (and generously donated) an extremely powerful library and
it is greatly appreciated. It is most likely just me.
As far as the book is concerned, I guess I'd purchase the only copy ;-).
I do appreciate your help very much.
Regards,
Larry
More information about the Python-list
mailing list