I think Robert has got it right. The idea is to send all the log event information to the remote server/client, and then let it process it as it wants. Sending it as text would require you to serialize/unserialize it in some fashion (probably xml...). That code comes pretty much straight from SocketAppender. Maybe it would be interesting to attach some kind of layout-like object that could determine what format (processed text or an object) to to send across the pipe.
The part of ServerSocketAppender that concerns me is that once the ServerSocket enters the accept() method, there is no way to "interrupt" it when you want to shut it down. Right now I set a short timeout on the ServerSocket, so it periodically interrupts itself and gives the thread a chance to see if it has been told to shutdown. But I would prefer some way to immediately interrupt it when it should shutdown. With the timeout, there can be a delay waiting for the appender to shutdown the ServerSocket thread. If anyone has any ideas on how to get around this in a better way, I'd like to hear about it. And thanks for the feedback. Let me know how it works for you. Since 1.2 is already beta and heading to final release, I guess it can't be included in log4j yet, but hopefully the next version? I have some code I wrote to test the appender. There is a server, pumping messages, and clients that connect and disconnect at various rates. If you'd like to take a look at that code, I can post it. -Mark -----Original Message----- From: Robert Bushman [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 4:43 AM To: Log4J Developers List Subject: Re: [SUBMIT] ServerSocketAppender.java On Thu, 7 Mar 2002, Niclas Hedhman wrote: > > Great idea. > Had a quick look, and saw the ObjectOutputStream (I have not looked at > the SocketAppender) and thought; why? > > Text output would be much more practical. Telnet to the port, and the > log messages arrives, formatted and ready... > > Am I missing something here? Not necessarily. If what you prefer is text ouput, what you describe is the ideal solution, and I think TelnetAppender is already included with the 1.2 beta. OTOH, I think the idea of this one is to be able to access the event objects, which can then be redirected to a local handler (EG to a local RollingFileAppender, or for display in a GUI tool, like Lumbermill). In fact, if and when I ever have a free moment from my job again :(, I was going to write the exact same thing. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
