Name
SocketHandler
Synopsis
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
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access