Build 1.0_r1(from source)

java.util.logging
Class SocketHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by java.util.logging.StreamHandler
          extended by java.util.logging.SocketHandler

public class SocketHandler
extends StreamHandler

A handler that writes log messages to a socket connection.

This handler reads the following properties from the log manager to initialize itself:

This handler buffers the outgoing messages, but flushes each time a log record has been published.

This class is not thread-safe.


Constructor Summary
SocketHandler()
          Constructs a SocketHandler object using the properties read by the log manager, including the host name and port number.
SocketHandler(String host, int port)
          Constructs a SocketHandler object using the specified host name and port number together with other properties read by the log manager.
 
Method Summary
 void close()
          Closes this handler.
 void publish(LogRecord record)
          Logs a record if necessary.
 
Methods inherited from class java.util.logging.StreamHandler
close, flush, internalSetOutputStream, isLoggable, setEncoding, setOutputStream
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, initProperties, internalSetEncoding, internalSetFormatter, printInvalidPropMessage, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketHandler

public SocketHandler()
              throws IOException
Constructs a SocketHandler object using the properties read by the log manager, including the host name and port number.

Throws:
IOException - If failed to connect to the specified host and port.
IllegalArgumentException - If the host name or port number is illegal.
SecurityException - If a security manager determines that the caller does not have the required permission to control this handler.

SocketHandler

public SocketHandler(String host,
                     int port)
              throws IOException
Constructs a SocketHandler object using the specified host name and port number together with other properties read by the log manager.

Parameters:
host - the host name
port - the port number
Throws:
IOException - If failed to connect to the specified host and port.
IllegalArgumentException - If the host name or port number is illegal.
SecurityException - If a security manager determines that the caller does not have the required permission to control this handler.
Method Detail

close

public void close()
Closes this handler. The network connection to the host is also closed.

Overrides:
close in class StreamHandler
Throws:
SecurityException - If a security manager determines that the caller does not have the required permission to control this handler.

publish

public void publish(LogRecord record)
Logs a record if necessary. A flush operation will be done afterwards.

Overrides:
publish in class StreamHandler
Parameters:
record - the log record to be logged

Build 1.0_r1(from source)

Please submit a feedback, bug or feature