> So I wonder if you guys could create a TCP appender? I guess 
> many people would love that, too :-)

We already have 2 TCP appenders - but maybe they are not what you want.

The RemotingAppender can be configured to use TCP. This allows
LoggingEvent objects to be sent over a TCP connection and reconstituted
on the target machine.

The TelnetAppender listens for TCP connections. This allows the log
viewer to connect into the application to receive log messages. This is
an inversion of the normal way of logging in that the app doing the
logging does not send the messages anywhere until a viewer actually
connects to it. This method is nice for the application because it
doesn't have to do any work when there are no viewers connected to it.

As far as writing something that operates like the UdpAppender but uses
TCP instead, it should be simple to get something working using a
socket. It is a little more complex when you start thinking about how to
maintain the connection and reconnect. log4j uses a separate thread to
attempt to reconnect every few seconds, which seems to be a reasonable
approach. It is worth noting that doing something like this means that
the appender (and hence the application hosting it) will be polling a
log view server every few seconds. If this server is only periodically
active then the application may be doing a lot of work for nothing.

Cheers,

Nicko 

Reply via email to