Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.util.logging

Class SocketHandler

java.lang.Object
|
+--java.util.logging.Handler
   |
   +--java.util.logging.StreamHandler
      |
      +--java.util.logging.SocketHandler


public class SocketHandler

extends StreamHandler

A SocketHandler publishes log records to a TCP/IP socket.

Configuration: Values of the subsequent LogManager properties are taken into consideration when a SocketHandler is initialized. If a property is not defined, or if it has an invalid value, a default is taken without an exception being thrown.

Author:

Constructor Summary

SocketHandler()

Constructs a SocketHandler that publishes log records to a TCP/IP socket.
SocketHandler(java.lang.String host, int port)

Constructs a SocketHandler that publishes log records to a TCP/IP socket.

Method Summary

voidpublish(java.util.logging.LogRecord record)

Publishes a LogRecord to the network socket, provided the record passes all tests for being loggable.

Constructor Details

SocketHandler

public SocketHandler()

Constructs a SocketHandler that publishes log records to a TCP/IP socket. Tthe initial configuration is determined by the LogManager properties described above.

Throws:


SocketHandler

public SocketHandler(java.lang.String host, int port)

Constructs a 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.

Parameters:

Throws:


Method Details

publish

public void publish(java.util.logging.LogRecord record)

Publishes a 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.

Parameters: