| java.lang.Object java.util.logging.Handler java.util.logging.StreamHandler java.util.logging.SocketHandler
SocketHandler | public class SocketHandler extends StreamHandler (Code) | | A handler that writes log messages to a socket connection.
This handler reads the following properties from the log manager to
initialize itself:
- java.util.logging.ConsoleHandler.level specifies the logging level,
defaults to
Level.ALL if this property is not found or has an
invalid value;
- java.util.logging.SocketHandler.filter specifies the name of the filter
class to be associated with this handler, defaults to
null if
this property is not found or has an invalid value;
- java.util.logging.SocketHandler.formatter specifies the name of the
formatter class to be associated with this handler, defaults to
java.util.logging.XMLFormatter if this property is not found
or has an invalid value;
- java.util.logging.SocketHandler.encoding specifies the encoding this
handler will use to encode log messages, defaults to
null if
this property is not found or has an invalid value.
- java.util.logging.SocketHandler.host specifies the name of the host that
this handler should connect to. There's no default value for this property.
- java.util.logging.SocketHandler.encoding specifies the port number that
this handler should connect to. There's no default value for this property.
This handler buffers the outgoing messages, but flushes each time a log
record has been published.
This class is not thread-safe.
|
Constructor Summary | |
public | SocketHandler() Constructs a SocketHandler object using the properties
read by the log manager, including the host name and port number. | public | 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 | |
public void | close() Closes this handler. | public void | publish(LogRecord record) Logs a record if necessary. |
SocketHandler | public SocketHandler() throws IOException(Code) | | 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. throws: IllegalArgumentException - If the host name or port number is illegal. throws: SecurityException - If a security manager determines that the caller does nothave the required permission to control this handler. |
SocketHandler | public SocketHandler(String host, int port) throws IOException(Code) | | 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 Parameters: port - the port number throws: IOException - If failed to connect to the specified host and port. throws: IllegalArgumentException - If the host name or port number is illegal. throws: SecurityException - If a security manager determines that the caller does nothave the required permission to control this handler. |
close | public void close()(Code) | | Closes this handler. The network connection to the host is also closed.
throws: SecurityException - If a security manager determines that the caller does nothave the required permission to control this handler. |
publish | public void publish(LogRecord record)(Code) | | Logs a record if necessary. A flush operation will be done afterwards.
Parameters: record - the log record to be logged |
|
|