public class XMLSocketReceiver extends Receiver implements 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 String |
decoder |
static int |
DEFAULT_PORT |
protected int |
port |
static String |
ZONE
The MulticastDNS zone advertised by an XMLSocketReceiver
|
thresholdLevel
active, name
repository
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.
|
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(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, setThreshold
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName
getLogger, getNonFloodingLogger, resetErrorCount
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getName, isActive
protected String decoder
public static final int DEFAULT_PORT
protected int port
public static final 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 String getDecoder()
public void setDecoder(String _decoder)
public boolean isPaused()
Pauseable
public void setPaused(boolean b)
Pauseable
public boolean isEquivalent(Plugin testPlugin)
isEquivalent
in interface Plugin
isEquivalent
in class PluginSkeleton
testPlugin
- The plugin to test equivalency against.protected void setActive(boolean b)
b
- new valuepublic void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)
public boolean isAdvertiseViaMulticastDNS()
public void shutdown()
public void run()
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.