org.apache.log4j.net
クラス SocketReceiver

java.lang.Object
  上位を拡張 org.apache.log4j.spi.ComponentBase
      上位を拡張 org.apache.log4j.plugins.PluginSkeleton
          上位を拡張 org.apache.log4j.plugins.Receiver
              上位を拡張 org.apache.log4j.net.SocketReceiver
すべての実装されたインタフェース:
java.lang.Runnable, NetworkBased, PortBased, org.apache.log4j.plugins.Pauseable, org.apache.log4j.plugins.Plugin, org.apache.log4j.spi.Component, org.apache.log4j.spi.OptionHandler, org.apache.log4j.spi.Thresholdable

public class SocketReceiver
extends org.apache.log4j.plugins.Receiver
implements java.lang.Runnable, PortBased, org.apache.log4j.plugins.Pauseable

SocketReceiver receives a remote logging event on a configured socket and "posts" it to a LoggerRepository as if the event was generated locally. This class is designed to receive events from the SocketAppender 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.

作成者:
Mark Womack, Scott Deboy (sdeboy@apache.org), Paul Smith (psmith@apache.org)

フィールドの概要
protected  int port
          Port.
static java.lang.String ZONE
          The MulticastDNS zone advertised by a SocketReceiver
 
クラス org.apache.log4j.plugins.Receiver から継承されたフィールド
thresholdLevel
 
クラス org.apache.log4j.plugins.PluginSkeleton から継承されたフィールド
active, name
 
クラス org.apache.log4j.spi.ComponentBase から継承されたフィールド
repository
 
コンストラクタの概要
SocketReceiver()
          Create new instance.
SocketReceiver(int p)
          Create new instance.
SocketReceiver(int p, org.apache.log4j.spi.LoggerRepository repo)
          Create new instance.
 
メソッドの概要
 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)
          
 java.util.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()
          推奨されていません。 This receiver now supports multiple listeners
 int getPort()
          Returns the Port # that this net based thing is using.
 boolean isAdvertiseViaMulticastDNS()
           
 boolean isEquivalent(org.apache.log4j.plugins.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 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)
          推奨されていません。 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)
          
 void setPort(int p)
          
 void shutdown()
          Called when the receiver should be stopped.
 
クラス org.apache.log4j.plugins.Receiver から継承されたメソッド
getThreshold, isAsSevereAsThreshold, setThreshold
 
クラス org.apache.log4j.plugins.PluginSkeleton から継承されたメソッド
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName
 
クラス org.apache.log4j.spi.ComponentBase から継承されたメソッド
getLogger, getNonFloodingLogger, resetErrorCount
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
インタフェース org.apache.log4j.net.NetworkBased から継承されたメソッド
getName, isActive
 

フィールドの詳細

port

protected int port
Port.


ZONE

public static final java.lang.String ZONE
The MulticastDNS zone advertised by a SocketReceiver

関連項目:
定数フィールド値
コンストラクタの詳細

SocketReceiver

public SocketReceiver()
Create new instance.


SocketReceiver

public SocketReceiver(int p)
Create new instance.

パラメータ:
p - port

SocketReceiver

public SocketReceiver(int p,
                      org.apache.log4j.spi.LoggerRepository repo)
Create new instance.

パラメータ:
p - port
repo - logger repository
メソッドの詳細

getPort

public int getPort()
Returns the Port # that this net based thing is using.

定義:
インタフェース PortBased 内の getPort
戻り値:
int port number

setPort

public void setPort(int p)


isEquivalent

public boolean isEquivalent(org.apache.log4j.plugins.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.

定義:
インタフェース org.apache.log4j.plugins.Plugin 内の isEquivalent
オーバーライド:
クラス org.apache.log4j.plugins.PluginSkeleton 内の isEquivalent
パラメータ:
testPlugin - The plugin to test equivalency against.
戻り値:
boolean True if the testPlugin is equivalent to this plugin.

activateOptions

public void activateOptions()
Starts the SocketReceiver with the current options.

定義:
インタフェース org.apache.log4j.spi.OptionHandler 内の activateOptions

shutdown

public void shutdown()
Called when the receiver should be stopped. Closes the server socket and all of the open sockets.

定義:
インタフェース org.apache.log4j.plugins.Plugin 内の shutdown

setActive

protected void setActive(boolean b)
Sets the flag to indicate if receiver is active or not.

パラメータ:
b - new value

setAdvertiseViaMulticastDNS

public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)

isAdvertiseViaMulticastDNS

public boolean isAdvertiseViaMulticastDNS()

run

public void run()
Loop, accepting new socket connections.

定義:
インタフェース java.lang.Runnable 内の run

getConnectedSocketDetails

public java.util.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.

戻り値:
Vector of SocketDetails

getListener

public SocketNodeEventListener getListener()
推奨されていません。 This receiver now supports multiple listeners

Returns the currently configured SocketNodeEventListener that will be automatically set for each SocketNode created.

戻り値:
SocketNodeEventListener currently configured

addSocketNodeEventListener

public void addSocketNodeEventListener(SocketNodeEventListener l)
Adds the listener to the list of listeners to be notified of the respective event.

パラメータ:
l - the listener to add to the list

removeSocketNodeEventListener

public void removeSocketNodeEventListener(SocketNodeEventListener l)
Removes the registered Listener from this instances list of listeners. If the listener has not been registered, then invoking this method has no effect.

パラメータ:
l - the SocketNodeEventListener to remove

setListener

public void setListener(SocketNodeEventListener l)
推奨されていません。 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

Sets the SocketNodeEventListener that will be used for each created SocketNode.

パラメータ:
l - the listener to set on each creation of a SocketNode

isPaused

public boolean isPaused()

定義:
インタフェース org.apache.log4j.plugins.Pauseable 内の isPaused

setPaused

public void setPaused(boolean b)

定義:
インタフェース org.apache.log4j.plugins.Pauseable 内の setPaused

doPost

public void doPost(org.apache.log4j.spi.LoggingEvent event)

オーバーライド:
クラス org.apache.log4j.plugins.Receiver 内の doPost


Copyright © 2010 Apache Software Foundation. All Rights Reserved.