org.apache.log4j.plugins
Class Receiver
java.lang.Object
org.apache.log4j.spi.ComponentBase
org.apache.log4j.plugins.PluginSkeleton
org.apache.log4j.plugins.Receiver
- All Implemented Interfaces:
- org.apache.log4j.plugins.Plugin, org.apache.log4j.spi.Component, org.apache.log4j.spi.OptionHandler, org.apache.log4j.spi.Thresholdable
- Direct Known Subclasses:
- CustomSQLDBReceiver, DBReceiver, JMSReceiver, LogFilePatternReceiver, LogFileXMLReceiver, MulticastReceiver, SocketHubReceiver, SocketReceiver, UDPReceiver, XMLSocketReceiver
public abstract class Receiver
- extends org.apache.log4j.plugins.PluginSkeleton
- implements org.apache.log4j.spi.Thresholdable
Defines the base class for Receiver plugins.
Just as Appenders send logging events outside of the log4j
environment (to files, to smtp, to sockets, etc), Receivers bring
logging events inside the log4j environment.
Receivers are meant to support the receiving of
remote logging events from another process. For example,
SocketAppender "appends" a logging event to a socket, configured
for a specific host and port number. On the receiving side of
the socket can be a SocketReceiver object. The SocketReceiver
object receives the logging event, and then "posts" it to the
log4j environment (LoggerRepository) on the receiving machine, to
be handled by the configured appenders, etc. The various
settings in this environment (Logger levels, Appender filters &
thresholds) are applied to the received logging event.
Receivers can also be used to "import" log messages from other
logging packages into the log4j environment.
Receivers can be configured to post events to a given
LoggerRepository.
Subclasses of Receiver must implement the isActive(),
activateOptions(), and shutdown() methods. The doPost() method
is provided to standardize the "import" of remote events into
the repository.
- Since:
- 1.3
- Author:
- Mark Womack, Ceki Gülcü, Paul Smith
Fields inherited from class org.apache.log4j.plugins.PluginSkeleton |
active, name |
Fields inherited from class org.apache.log4j.spi.ComponentBase |
repository |
Method Summary |
void |
doPost(org.apache.log4j.spi.LoggingEvent event)
Posts the logging event to a logger in the configured logger
repository. |
org.apache.log4j.Level |
getThreshold()
Gets the current threshold setting of the receiver. |
boolean |
isAsSevereAsThreshold(org.apache.log4j.Level level)
Returns true if the given level is equals or greater than the current
threshold value of the receiver. |
void |
setThreshold(org.apache.log4j.Level level)
Sets the receiver theshold to the given level. |
Methods inherited from class org.apache.log4j.plugins.PluginSkeleton |
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, isEquivalent, 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.plugins.Plugin |
shutdown |
Methods inherited from interface org.apache.log4j.spi.OptionHandler |
activateOptions |
thresholdLevel
protected org.apache.log4j.Level thresholdLevel
Receiver
public Receiver()
setThreshold
public void setThreshold(org.apache.log4j.Level level)
- Sets the receiver theshold to the given level.
- Specified by:
setThreshold
in interface org.apache.log4j.spi.Thresholdable
- Parameters:
level
- The threshold level events must equal or be greater
than before further processing can be done.
getThreshold
public org.apache.log4j.Level getThreshold()
- Gets the current threshold setting of the receiver.
- Specified by:
getThreshold
in interface org.apache.log4j.spi.Thresholdable
- Returns:
- Level The current threshold level of the receiver.
isAsSevereAsThreshold
public boolean isAsSevereAsThreshold(org.apache.log4j.Level level)
- Returns true if the given level is equals or greater than the current
threshold value of the receiver.
- Specified by:
isAsSevereAsThreshold
in interface org.apache.log4j.spi.Thresholdable
- Parameters:
level
- The level to test against the receiver threshold.
- Returns:
- boolean True if level is equal or greater than the
receiver threshold.
doPost
public void doPost(org.apache.log4j.spi.LoggingEvent event)
- Posts the logging event to a logger in the configured logger
repository.
- Parameters:
event
- the log event to post to the local log4j environment.
Copyright 2000-2003 Apache Software Foundation.