|
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.SocketReceiver
public class SocketReceiver
SocketReceiver 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 SocketAppender 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.
Nested Class Summary | |
---|---|
static class |
SocketReceiver.SocketDetail
|
Field Summary | |
---|---|
protected int |
port
|
Fields inherited from class org.apache.log4j.plugins.Receiver |
---|
thresholdLevel |
Fields inherited from class org.apache.log4j.plugins.PluginSkeleton |
---|
active, name |
Fields inherited from class org.apache.log4j.spi.ComponentBase |
---|
repository |
Constructor Summary | |
---|---|
SocketReceiver()
|
|
SocketReceiver(int _port)
|
|
SocketReceiver(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 listener)
Adds the listener to the list of listeners to be notified of the respective event |
void |
doPost(org.apache.log4j.spi.LoggingEvent event)
Posts the logging event to a logger in the configured logger repository. |
java.util.Vector |
getConnectedSocketDetails()
Returns a Vector of SocketDetail representing the IP/Domain name of the currently connected sockets that this receiver has been responsible for creating. |
org.apache.log4j.net.SocketNodeEventListener |
getListener()
Deprecated. This receiver now supports multiple listeners |
int |
getPort()
Get the port to receive logging events on. |
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. |
boolean |
isPaused()
|
void |
removeSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener listener)
Removes the registered Listener from this instances list of listeners. |
void |
run()
Loop, accepting new socket connections. |
void |
setListener(org.apache.log4j.net.SocketNodeEventListener listener)
Deprecated. This receiver now supports multiple listeners and so this method simply removes the listener (if there already) and readds it to the list. The passed listener will also be returned via the getListener() method still, but this is also deprecated |
void |
setPaused(boolean b)
|
void |
setPort(int _port)
Set the port to receive logging events on. |
void |
shutdown()
Called when the receiver should be stopped. |
Methods inherited from class org.apache.log4j.plugins.Receiver |
---|
getThreshold, isAsSevereAsThreshold, setThreshold |
Methods inherited from class org.apache.log4j.plugins.PluginSkeleton |
---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, 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, isActive |
Field Detail |
---|
protected int port
Constructor Detail |
---|
public SocketReceiver()
public SocketReceiver(int _port)
public SocketReceiver(int _port, org.apache.log4j.spi.LoggerRepository _repository)
Method Detail |
---|
public int getPort()
getPort
in interface org.apache.log4j.net.PortBased
public void setPort(int _port)
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 void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
public void shutdown()
shutdown
in interface org.apache.log4j.plugins.Plugin
public void run()
run
in interface java.lang.Runnable
public java.util.Vector getConnectedSocketDetails()
public org.apache.log4j.net.SocketNodeEventListener getListener()
public void addSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener listener)
listener
- the listener to add to the listpublic void removeSocketNodeEventListener(org.apache.log4j.net.SocketNodeEventListener listener)
listener
- the SocketNodeEventListener to removepublic void setListener(org.apache.log4j.net.SocketNodeEventListener listener)
listener
- the listener to set on each creation of a SocketNodepublic boolean isPaused()
isPaused
in interface org.apache.log4j.plugins.Pauseable
public void setPaused(boolean b)
setPaused
in interface org.apache.log4j.plugins.Pauseable
public void doPost(org.apache.log4j.spi.LoggingEvent event)
Receiver
doPost
in class Receiver
event
- the log event to post to the local log4j environment.
|
Log4j 2.0alpha-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |