[logback-dev] [Bug 105] SocketAppenderBase - ObjectOutputStream is not closed in case of an IOException.

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Wed Mar 5 00:23:17 CET 2008


http://bugzilla.qos.ch/show_bug.cgi?id=105





------- Comment #3 from joern at huxhorn.de  2008-03-05 00:23 -------
What you say both applies and makes sense.

In our case the webapp had several instances of SocketAppender with numerous
SocketServers as clients (my logging app used by several people). Whenever one
of the clients just vanished, for example by closing the lid of a laptop, the
webapp would grind to a halt!

I was a little shocked :) 

So I implemented my own appender using a TimeoutOutputStream to solve the
problem of server blocking. But I still have another problem where the client
doesn't realize that he has been disconnected from the server, for example by
pulling the network cable.

I think I'll implement a server heartbeat to solve this...

My implementation is a multiplexing appender that sends events to a
configurable list of event receivers. The events are serialized only once and
optionally gzipped.

But to get back on topic:
I think it's a valid general rule to close every resource that is opened, if
possible/necessary inside a finally. That way it's closed in either way, both
in case of exception and without, and you just don't have to care about it
anymore.
(OK, I didn't do that in the test case but it's just a test case ;))

I'm especially "suspicious" towards ObjectOutputStream because it partially
caches the serialized objects.


-- 
Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the logback-dev mailing list