public class StreamHandler extends Object
StreamHandler
publishes log to a instances of
java.io.OutputStream
.Constructor and Description |
---|
StreamHandler()
Creates a
StreamHandler without an output stream. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this
StreamHandler after having forced any data that
may have been buffered to the underlying output device. |
void |
flush()
Forces any data that may have been buffered to the underlying output
device.
|
void |
publish(String component,
String level,
String message,
Object[] params) |
public StreamHandler()
StreamHandler
without an output stream. Subclasses
can later use setOutputStream(java.io.OutputStream)
to associate
an output stream with this StreamHandler.public void close()
StreamHandler
after having forced any data that
may have been buffered to the underlying output device.
As soon as close
has been called, a Handler
should not be used anymore. Attempts to publish log records, to flush
buffers, or to modify the Handler
in any other way may throw
runtime exceptions after calling close
.
In case of an I/O failure, the ErrorManager
of this
Handler
will be informed, but the caller of this method will
not receive an exception.
If a StreamHandler
that has been closed earlier is closed a
second time, the Sun J2SE 1.4 reference can be observed to silently
ignore the call. The GNU implementation, however, intentionally behaves
differently by informing the ErrorManager
associated with
this StreamHandler
. Since the condition indicates a
programming error, the programmer should be informed. It also seems
extremely unlikely that any application would depend on the exact
behavior in this rather obscure, erroneous case -- especially since the
API specification does not prescribe what is supposed to happen.
public void flush()
In case of an I/O failure, the ErrorManager
of this
Handler
will be informed, but the caller of this method will
not receive an exception.
If a StreamHandler
that has been closed earlier is closed a
second time, the Sun J2SE 1.4 reference can be observed to silently
ignore the call. The GNU implementation, however, intentionally behaves
differently by informing the ErrorManager
associated with
this StreamHandler
. Since the condition indicates a
programming error, the programmer should be informed. It also seems
extremely unlikely that any application would depend on the exact
behavior in this rather obscure, erroneous case -- especially since the
API specification does not prescribe what is supposed to happen.