Team LiB
Previous Section Next Section

SocketHandlerjava.util.logging

Java 1.4

This Handler subclass formats LogRecord objects and outputs the resulting strings to a network socket. When you create a SocketHandler, you can pass the hostname and port of the socket to the constructor or you can rely on system-wide defaults obtained with LogManager.getProperty( ). SocketHandler also uses LogManager.getProperty( ) to obtain initial values for the properties inherited from Handler. The table below lists these properties, as well as the host and port arguments, the value passed to getProperty( ), and the default value used if getProperty( ) returns null. See Handler for further details.

Handler property

LogManager property name

Default

level

java.util.logging.SocketHandler.level

Level.ALL

filter

java.util.logging.SocketHandler.filter

null

formatter

java.util.logging.SocketHandler.formatter

XMLFormatter

encoding

java.util.logging.SocketHandler.encoding

platform default

hostname

java.util.logging.SocketHandler.host

no default

port

java.util.logging.SocketHandler.port

no default


Figure 16-121. java.util.logging.SocketHandler


public class SocketHandler extends StreamHandler {
// Public Constructors
     public SocketHandler( ) throws java.io.IOException;  
     public SocketHandler(String host, int port) throws java.io.IOException;  
// Public Methods Overriding StreamHandler
     public void close( ) throws SecurityException;                 synchronized
     public void publish(LogRecord record);                       synchronized
}

Team LiB
Previous Section Next Section