Handler.
LogRecords are published to a network stream connection. By default
the XMLFormatter class is used for formatting.
Configuration:
By default each SocketHandler is initialized using the following
LogManager configuration properties where <handler-name>
refers to the fully-qualified class name of the handler.
If properties are not defined
(or have invalid values) then the specified default values are used.
Handler
(defaults to Level.ALL). Filter class to use
(defaults to no Filter). Formatter class to use
(defaults to java.util.logging.XMLFormatter).
For example, the properties for SocketHandler would be:
For a custom handler, e.g. com.foo.MyHandler, the properties would be:
The output IO stream is buffered, but is flushed after each
LogRecord is written.
| Access | Constructor and Description |
|---|---|
| public | |
| public | SocketHandler(String
target host. host, int target port. port)Construct a |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| private void | |
| public void | publish(LogRecord
description of the log event. A null record is
silently ignored and is not published record)Overrides java. Format and publish a |
| host | back to summary |
|---|---|
| private String host | |
| port | back to summary |
|---|---|
| private int port | |
| sock | back to summary |
|---|---|
| private Socket sock | |
| SocketHandler | back to summary |
|---|---|
| public SocketHandler() throws IOException Create a
| |
| SocketHandler | back to summary |
|---|---|
| public SocketHandler(String host, int port) throws IOException Construct a
| |
| close | back to summary |
|---|---|
| public synchronized void close() Overrides java. Close this output stream.
| |
| connect | back to summary |
|---|---|
| private void connect() throws IOException | |
| publish | back to summary |
|---|---|
| public void publish(LogRecord record) Overrides java. Format and publish a Implementation Specification This method is not synchronized, and subclasses must not define
overridden | |