[logback-user] Please add a timeout to SocketAppenderBase.connect(...)

Joern Huxhorn jhuxhorn at bpinteractive.com
Tue Jul 31 18:37:52 CEST 2007


Hi guys.

It would be really great if you could change the line

oos = new ObjectOutputStream(new Socket(address, port).getOutputStream());

in method void connect(InetAddress address, int port) of class 
SocketAppenderBase with

SocketAddress address=new InetSocketAddress(address, port);
Socket socket=new Socket();
socket.connect(address, connectionTimeout);
oos = new ObjectOutputStream(socket.getOutputStream());

using something reasonable as connectionTimeout, e.g. 1000-2000ms. 
connectionTimeout should be configurable, too.

At the moment our webapp waits quite some time if a registered 
SocketServer isn't online at startup.

I'd also suggest wrapping the sockets outputstream into a 
BufferedOutputStream, flushing it after every event.

Thanks, Joern.




More information about the Logback-user mailing list