org.apache.log4j.net

Class SocketAppender

public class SocketAppender extends AppenderSkeleton

Sends LoggingEvent objects to a remote a log server, usually a SocketNode.

The SocketAppender has the following properties:

Since: 0.8.4

Author: Ceki Gülcü

Constructor Summary
SocketAppender()
SocketAppender(InetAddress address, int port)
Connects to remote server at address and port.
SocketAppender(String host, int port)
Connects to remote server at host and port.
Method Summary
voidactivateOptions()
Connect to the specified RemoteHost and Port.
voidappend(LoggingEvent event)
voidcleanUp()
Drop the connection to the remote host and release the underlying connector thread if it has been created
voidclose()
Close this appender.
booleangetLocationInfo()
Returns value of the LocationInfo option.
intgetPort()
Returns value of the Port option.
intgetReconnectionDelay()
Returns value of the ReconnectionDelay option.
StringgetRemoteHost()
Returns value of the RemoteHost option.
booleanrequiresLayout()
The SocketAppender does not use a layout.
voidsetLocationInfo(boolean locationInfo)
The LocationInfo option takes a boolean value.
voidsetPort(int port)
The Port option takes a positive integer representing the port where the server is waiting for connections.
voidsetReconnectionDelay(int delay)
The ReconnectionDelay option takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server.
voidsetRemoteHost(String host)
The RemoteHost option takes a string value which should be the host name of the server where a SocketNode is running.

Constructor Detail

SocketAppender

public SocketAppender()

SocketAppender

public SocketAppender(InetAddress address, int port)
Connects to remote server at address and port.

SocketAppender

public SocketAppender(String host, int port)
Connects to remote server at host and port.

Method Detail

activateOptions

public void activateOptions()
Connect to the specified RemoteHost and Port.

append

public void append(LoggingEvent event)

cleanUp

public void cleanUp()
Drop the connection to the remote host and release the underlying connector thread if it has been created

close

public void close()
Close this appender.

This will mark the appender as closed and call then SocketAppender method.

getLocationInfo

public boolean getLocationInfo()
Returns value of the LocationInfo option.

getPort

public int getPort()
Returns value of the Port option.

getReconnectionDelay

public int getReconnectionDelay()
Returns value of the ReconnectionDelay option.

getRemoteHost

public String getRemoteHost()
Returns value of the RemoteHost option.

requiresLayout

public boolean requiresLayout()
The SocketAppender does not use a layout. Hence, this method returns false.

setLocationInfo

public void setLocationInfo(boolean locationInfo)
The LocationInfo option takes a boolean value. If true, the information sent to the remote host will include location information. By default no location information is sent to the server.

setPort

public void setPort(int port)
The Port option takes a positive integer representing the port where the server is waiting for connections.

setReconnectionDelay

public void setReconnectionDelay(int delay)
The ReconnectionDelay option takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server. The default value of this option is 30000 which corresponds to 30 seconds.

Setting this option to zero turns off reconnection capability.

setRemoteHost

public void setRemoteHost(String host)
The RemoteHost option takes a string value which should be the host name of the server where a SocketNode is running.
Copyright 2000-2005 Apache Software Foundation.