java.lang.Object
|
+--java.util.logging.Handler
|
+--java.util.logging.StreamHandler
|
+--java.util.logging.SocketHandler
SocketHandler() Constructs a |
SocketHandler(java.lang.String host, int port) Constructs a |
void | publish(java.util.logging.LogRecord record) Publishes a |
public SocketHandler()SocketHandler that publishes log
records to a TCP/IP socket. Tthe initial configuration is
determined by the LogManager properties described
above.
IOException - if the connection to the specified
network host and port cannot be established.IllegalArgumentException - if either the
java.util.logging.SocketHandler.host
or java.util.logging.SocketHandler.port
LogManager properties is not defined, or specifies
an invalid value.public SocketHandler(java.lang.String host, int port)SocketHandler that publishes log
records to a TCP/IP socket. With the exception of the internet
host and port, the initial configuration is determined by the
LogManager properties described above.
host - the Internet host to which log records will be
forwarded.port - the port at the host which will accept a request
for a TCP/IP connection.IOException - if the connection to the specified
network host and port cannot be established.IllegalArgumentException - if either
host or port specify
an invalid value.public void publish(java.util.logging.LogRecord record)LogRecord to the network socket,
provided the record passes all tests for being loggable.
In addition, all data that may have been buffered will
be forced to the network stream.
Most applications do not need to call this method directly. Instead, they will use a Logger instance, which will create LogRecords and distribute them to registered handlers.
In case of an I/O failure, the ErrorManager
of this SocketHandler will be informed, but the caller
of this method will not receive an exception.
record - the log event to be published.
SocketHandlerpublishes log records to a TCP/IP socket.Configuration: Values of the subsequent
LogManagerproperties are taken into consideration when aSocketHandleris initialized. If a property is not defined, or if it has an invalid value, a default is taken without an exception being thrown.java.util.SocketHandler.level- specifies the initial severity level threshold. Default value:Level.ALL.java.util.SocketHandler.filter- specifies the name of a Filter class. Default value: No Filter.java.util.SocketHandler.formatter- specifies the name of a Formatter class. Default value:java.util.logging.XMLFormatter.java.util.SocketHandler.encoding- specifies the name of the character encoding. Default value: the default platform encoding.java.util.SocketHandler.host- specifies the name of the host to which records are published. There is no default value for this property; if it is not set, the SocketHandler constructor will throw an exception.java.util.SocketHandler.port- specifies the TCP/IP port to which records are published. There is no default value for this property; if it is not set, the SocketHandler constructor will throw an exception.