public class XMLSocketReceiver extends Receiver implements java.lang.Runnable, PortBased, Pauseable
This receiver supports log files created using log4j's XMLLayout, as well as java.util.logging XMLFormatter (via the org.apache.log4j.spi.Decoder interface).
By default, log4j's XMLLayout is supported (no need to specify a decoder in that case).
To configure this receiver to support java.util.logging's XMLFormatter, specify a 'decoder' param of org.apache.log4j.xml.UtilLoggingXMLDecoder.
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 java.lang.String |
decoder |
static int |
DEFAULT_PORT |
protected int |
port |
static java.lang.String |
ZONE
The MulticastDNS zone advertised by an XMLSocketReceiver
|
thresholdLevelactive, namerepository| Constructor and Description |
|---|
XMLSocketReceiver() |
XMLSocketReceiver(int _port) |
XMLSocketReceiver(int _port,
org.apache.log4j.spi.LoggerRepository _repository) |
| Modifier and Type | Method and Description |
|---|---|
void |
activateOptions()
Starts the SocketReceiver with the current options.
|
void |
doPost(org.apache.log4j.spi.LoggingEvent event)
Posts the logging event to a logger in the configured logger
repository.
|
java.lang.String |
getDecoder() |
int |
getPort()
Get the port to receive logging events on.
|
int |
hashCode() |
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 |
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 |
setDecoder(java.lang.String _decoder)
Specify the class name implementing org.apache.log4j.spi.Decoder that can process the file.
|
void |
setPaused(boolean b)
Set paused state.
|
void |
setPort(int _port)
Set the port to receive logging events on.
|
void |
shutdown()
Called when the receiver should be stopped.
|
getThreshold, isAsSevereAsThreshold, setThresholdaddPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setNamegetLogger, getNonFloodingLogger, resetErrorCountclone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetName, isActiveprotected java.lang.String decoder
public static final int DEFAULT_PORT
protected int port
public static final java.lang.String ZONE
public XMLSocketReceiver()
public XMLSocketReceiver(int _port)
public XMLSocketReceiver(int _port,
org.apache.log4j.spi.LoggerRepository _repository)
public int getPort()
public void setPort(int _port)
public java.lang.String getDecoder()
public void setDecoder(java.lang.String _decoder)
public boolean isPaused()
Pauseablepublic void setPaused(boolean b)
Pauseablepublic boolean isEquivalent(Plugin testPlugin)
isEquivalent in interface PluginisEquivalent in class PluginSkeletontestPlugin - The plugin to test equivalency against.public int hashCode()
hashCode in class java.lang.Objectprotected void setActive(boolean b)
b - new valuepublic void activateOptions()
activateOptions in interface org.apache.log4j.spi.OptionHandlerpublic void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)
public boolean isAdvertiseViaMulticastDNS()
public void shutdown()
public void run()
run in interface java.lang.RunnableCopyright © 2018. All rights reserved.