Skip to content

Most visited

Recently visited

navigation
Added in API level 1

SocketHandler

public class SocketHandler
extends StreamHandler

java.lang.Object
   ↳ java.util.logging.Handler
     ↳ java.util.logging.StreamHandler
       ↳ java.util.logging.SocketHandler


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.

Summary

Public constructors

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.

Public methods

void close()

Closes this handler.

void publish(LogRecord record)

Logs a record if necessary.

Inherited methods

From class java.util.logging.StreamHandler
From class java.util.logging.Handler
From class java.lang.Object

Public constructors

SocketHandler

Added in API level 1
SocketHandler ()

Constructs a SocketHandler object using the properties read by the log manager, including the host name and port number. Default formatting uses the XMLFormatter class and level is set to ALL.

Throws
IOException if failed to connect to the specified host and port.
IllegalArgumentException if the host name or port number is illegal.

SocketHandler

Added in API level 1
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. Default formatting uses the XMLFormatter class and level is set to ALL.

Parameters
host String: the host name
port int: 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.

Public methods

close

Added in API level 1
void close ()

Closes this handler. The network connection to the host is also closed.

publish

Added in API level 1
void publish (LogRecord record)

Logs a record if necessary. A flush operation will be done afterwards.

Parameters
record LogRecord: the log record to be logged.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.