public class SocketReceiver extends Receiver implements Runnable, PortBased, Pauseable
Once the event has been "posted", it will be handled by the appenders currently configured in the LoggerRespository.
Modifier and Type | Field and Description |
---|---|
protected int |
port
Port.
|
static String |
ZONE
The MulticastDNS zone advertised by a SocketReceiver
|
thresholdLevel
active, name
repository
Constructor and Description |
---|
SocketReceiver()
Create new instance.
|
SocketReceiver(int p)
Create new instance.
|
SocketReceiver(int p,
org.apache.log4j.spi.LoggerRepository repo)
Create new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
activateOptions()
Starts the SocketReceiver with the current options.
|
void |
addSocketNodeEventListener(SocketNodeEventListener l)
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.
|
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.
|
SocketNodeEventListener |
getListener()
Deprecated.
This receiver now supports multiple listeners
|
int |
getPort()
Returns the Port # that this net based thing is using.
|
boolean |
isAdvertiseViaMulticastDNS() |
boolean |
isEquivalent(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()
Get paused state.
|
void |
removeSocketNodeEventListener(SocketNodeEventListener l)
Removes the registered Listener from this instances list of
listeners.
|
void |
run()
Loop, accepting new socket connections.
|
protected void |
setActive(boolean b)
Sets the flag to indicate if receiver is active or not.
|
void |
setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS) |
void |
setListener(SocketNodeEventListener l)
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)
Set paused state.
|
void |
setPort(int p) |
void |
shutdown()
Called when the receiver should be stopped.
|
getThreshold, isAsSevereAsThreshold, setThreshold
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName
getLogger, getNonFloodingLogger, resetErrorCount
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, isActive
protected int port
public static final String ZONE
public SocketReceiver()
public SocketReceiver(int p)
p
- portpublic SocketReceiver(int p, org.apache.log4j.spi.LoggerRepository repo)
p
- portrepo
- logger repositorypublic int getPort()
public void setPort(int p)
public boolean isEquivalent(Plugin testPlugin)
isEquivalent
in interface Plugin
isEquivalent
in class PluginSkeleton
testPlugin
- The plugin to test equivalency against.public void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
public void shutdown()
protected void setActive(boolean b)
b
- new valuepublic void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)
public boolean isAdvertiseViaMulticastDNS()
public void run()
public Vector getConnectedSocketDetails()
public SocketNodeEventListener getListener()
public void addSocketNodeEventListener(SocketNodeEventListener l)
l
- the listener to add to the listpublic void removeSocketNodeEventListener(SocketNodeEventListener l)
l
- the SocketNodeEventListener to removepublic void setListener(SocketNodeEventListener l)
l
- the listener to set on each creation of a SocketNodepublic boolean isPaused()
public void setPaused(boolean b)
Copyright © 2002-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.