org.apache.log4j.net
Class XMLSocketReceiver
java.lang.Object
|
+--org.apache.log4j.spi.ComponentBase
|
+--org.apache.log4j.plugins.PluginSkeleton
|
+--org.apache.log4j.plugins.Receiver
|
+--org.apache.log4j.net.XMLSocketReceiver
- All Implemented Interfaces:
- Component, NetworkBased, OptionHandler, Pauseable, Plugin, PortBased, Runnable, Thresholdable
- public class XMLSocketReceiver
- extends Receiver
- implements Runnable, PortBased, Pauseable
XMLSocketReceiver receives a remote logging event via XML on a configured
socket and "posts" it to a LoggerRepository as if the event were
generated locally. This class is designed to receive events from
the XMLSocketAppender 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.
- Since:
- 1.3
- Author:
- Mark Womack, Scott Deboy
Method Summary |
void |
activateOptions()
Starts the SocketReceiver with the current options. |
void |
doPost(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 |
isActive()
Returns true if this receiver is active. |
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()
|
void |
run()
Loop, accepting new socket connections. |
void |
setDecoder(String _decoder)
|
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.PluginSkeleton |
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName |
active
protected boolean active
decoder
protected String decoder
DEFAULT_PORT
public static final int DEFAULT_PORT
port
protected int port
XMLSocketReceiver
public XMLSocketReceiver()
XMLSocketReceiver
public XMLSocketReceiver(int _port)
XMLSocketReceiver
public XMLSocketReceiver(int _port,
LoggerRepository _repository)
getPort
public int getPort()
- Get the port to receive logging events on.
- Specified by:
getPort
in interface PortBased
- Following copied from interface:
org.apache.log4j.net.PortBased
- Returns:
- int port number
setPort
public void setPort(int _port)
- Set the port to receive logging events on.
getDecoder
public String getDecoder()
setDecoder
public void setDecoder(String _decoder)
isPaused
public boolean isPaused()
- Specified by:
isPaused
in interface Pauseable
setPaused
public void setPaused(boolean b)
- Specified by:
setPaused
in interface Pauseable
isEquivalent
public 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. This is used by PluginRegistry when determining
if the a similarly configured receiver is being started.
- Overrides:
isEquivalent
in class PluginSkeleton
- Parameters:
testPlugin
- The plugin to test equivalency against.- Returns:
- boolean True if the testPlugin is equivalent to this plugin.
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
isActive
public boolean isActive()
- Returns true if this receiver is active.
- Specified by:
isActive
in interface NetworkBased
- Overrides:
isActive
in class PluginSkeleton
- Following copied from class:
org.apache.log4j.plugins.PluginSkeleton
- Returns:
- true/false
activateOptions
public void activateOptions()
- Starts the SocketReceiver with the current options.
shutdown
public void shutdown()
- Called when the receiver should be stopped. Closes the
server socket and all of the open sockets.
run
public void run()
- Loop, accepting new socket connections.
- Specified by:
run
in interface Runnable
doPost
public void doPost(LoggingEvent event)
- Description copied from class:
Receiver
- Posts the logging event to a logger in the configured logger
repository.
- Overrides:
doPost
in class Receiver
- Following copied from class:
org.apache.log4j.plugins.Receiver
- Parameters:
event
- the log event to post to the local log4j environment.
Copyright © 2000-2006 Apache Software Foundation.
Licensed under the Apache License, Version 2.0.