|
Log4j 2.0alpha-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log4j.spi.ComponentBase
org.apache.log4j.plugins.PluginSkeleton
org.apache.log4j.plugins.Receiver
org.apache.log4j.net.SocketHubReceiver
public class SocketHubReceiver
SocketHubReceiver receives a remote logging event on a configured socket and "posts" it to a LoggerRepository as if the event was generated locally. This class is designed to receive events from the SocketHubAppender class (or classes that send compatible events).
Once the event has been "posted", it will be handled by the appenders currently configured in the LoggerRespository.
Field Summary | |
---|---|
protected boolean |
active
|
protected org.apache.log4j.net.SocketHubReceiver.Connector |
connector
|
protected java.lang.String |
host
|
protected int |
port
|
protected int |
reconnectionDelay
|
protected java.net.Socket |
socket
|
Fields inherited from class org.apache.log4j.plugins.Receiver |
---|
thresholdLevel |
Fields inherited from class org.apache.log4j.plugins.PluginSkeleton |
---|
name |
Fields inherited from class org.apache.log4j.spi.ComponentBase |
---|
repository |
Constructor Summary | |
---|---|
SocketHubReceiver()
|
|
SocketHubReceiver(java.lang.String _host,
int _port)
|
|
SocketHubReceiver(java.lang.String _host,
int _port,
org.apache.log4j.spi.LoggerRepository _repository)
|
Method Summary | |
---|---|
void |
activateOptions()
Starts the SocketReceiver with the current options. |
void |
addSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener l)
Adds a SocketNodeEventListener to this receiver to be notified of SocketNode events |
java.lang.String |
getHost()
Get the remote host to connect to for logging events. |
int |
getPort()
Get the remote port to connect to for logging events. |
int |
getReconnectionDelay()
Returns value of the ReconnectionDelay option. |
boolean |
isActive()
Returns true if this receiver is active. |
boolean |
isEquivalent(org.apache.log4j.plugins.Plugin testPlugin)
Returns true if the receiver is the same class and they are configured for the same properties, and super class also considers them to be equivalent. |
void |
removeSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener l)
Removes a specific SocketNodeEventListener from this instance so that it will no longer be notified of SocketNode events. |
protected void |
setActive(boolean _active)
Sets the flag to indicate if receiver is active or not. |
void |
setHost(java.lang.String host)
Configures the Host property, this will require activateOptions to be called for this to take effect. |
void |
setPort(int _port)
Set the remote port to connect to for logging events. |
void |
setPort(java.lang.String _host)
Set the remote host to connect to for logging events. |
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. |
void |
shutdown()
Called when the receiver should be stopped. |
void |
socketClosedEvent(java.lang.Exception e)
Listen for a socketClosedEvent from the SocketNode. |
void |
socketOpened(java.lang.String remoteInfo)
|
Methods inherited from class org.apache.log4j.plugins.Receiver |
---|
doPost, getThreshold, isAsSevereAsThreshold, setThreshold |
Methods inherited from class org.apache.log4j.plugins.PluginSkeleton |
---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName |
Methods inherited from class org.apache.log4j.spi.ComponentBase |
---|
getLogger, getNonFloodingLogger, resetErrorCount |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.log4j.net.NetworkBased |
---|
getName |
Field Detail |
---|
protected java.lang.String host
protected int port
protected int reconnectionDelay
protected boolean active
protected org.apache.log4j.net.SocketHubReceiver.Connector connector
protected java.net.Socket socket
Constructor Detail |
---|
public SocketHubReceiver()
public SocketHubReceiver(java.lang.String _host, int _port)
public SocketHubReceiver(java.lang.String _host, int _port, org.apache.log4j.spi.LoggerRepository _repository)
Method Detail |
---|
public void addSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener l)
l
- public void removeSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener l)
l
- public java.lang.String getHost()
public void setHost(java.lang.String host)
host
- public void setPort(java.lang.String _host)
public int getPort()
getPort
in interface org.apache.log4j.net.PortBased
public void setPort(int _port)
public void setReconnectionDelay(int delay)
Setting this option to zero turns off reconnection capability.
public int getReconnectionDelay()
public boolean isEquivalent(org.apache.log4j.plugins.Plugin testPlugin)
isEquivalent
in interface org.apache.log4j.plugins.Plugin
isEquivalent
in class org.apache.log4j.plugins.PluginSkeleton
testPlugin
- The plugin to test equivalency against.
public boolean isActive()
isActive
in interface org.apache.log4j.net.NetworkBased
isActive
in interface org.apache.log4j.plugins.Plugin
isActive
in class org.apache.log4j.plugins.PluginSkeleton
protected void setActive(boolean _active)
public void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
public void shutdown()
shutdown
in interface org.apache.log4j.plugins.Plugin
public void socketClosedEvent(java.lang.Exception e)
socketClosedEvent
in interface org.apache.log4j.net.SocketNodeEventListener
public void socketOpened(java.lang.String remoteInfo)
socketOpened
in interface org.apache.log4j.net.SocketNodeEventListener
|
Log4j 2.0alpha-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |