Mark,
It is not that easy for sockets. The OS has a TCP buffer independent of Java. This
buffer you can not flush nor get a quick response whether the data is transmitted.
Most time when your connections are stable this is no major drawback but if you deal
with unreliable links it might be.
For reliable links I think it is only necessary to set the linger time to an
appropriate value.
If you deal with unreliable links more effort is necessary.
Kind regards
Frank-Olaf Lohmann
>>> Mark Douglas <[EMAIL PROTECTED]> 01.02.2001 12.04 Uhr >>>
Hi All,
I would like for a new method to be added to the Category class (along the
lines of the shutdown() method). The new method 'flush' would be called to
flush the buffers of all appenders in all categories. This really only
makes sense for SocketAppender and AsyncAppender as the other appenders
don't tend to buffer output (my understanding - possibly incorrect). Most
appenders would simply return from a call to their flush() method. The
SocketAppender would call oos.flush() for example.
The reason:
At the moment, the only way to ensure that all Appender output is 'flushed'
is to call Category.shutdown(). This is fine for an app. that is about to
terminate, but for an app. that is continuing, calling Category.shutdown()
means that no further logging takes place.
Why do I want to flush the buffers?
I have some utility code that is used in a number of applications. After my
code is called, some apps terminate and other do not. If I call
Category.shutdown() before my code returns, the apps that terminate are
fine, but the others carry on and can't perform further logging (all the
appenders have been deleted). If I don't call Category.shutdown(), the apps
that terminate lose a few logging messages because they are buffered in the
SocketAppender.
To fix this, my utility code needs to be able to flush the buffers before
returning. This way, both types of app. would work correctly. Also, I
don't the apps to have to 'know' about log4j and therefore it would be
unreasonable for them to call Category.shutdown() before they exit.
Ceki, is it possible to add this functionality for 1.1? Or is there
something I can do right now to solve this?
Mark Douglas
Systems Union Group
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]