Class UDPReceiver

All Implemented Interfaces:
NetworkBased, PortBased, Pauseable, Plugin, Component, org.apache.log4j.spi.OptionHandler, Thresholdable

public class UDPReceiver extends Receiver implements PortBased, Pauseable
Receive LoggingEvents encoded with an XMLLayout, convert the XML data to a LoggingEvent and post the LoggingEvent.
  • Field Details

    • PACKET_LENGTH

      private static final int PACKET_LENGTH
      See Also:
    • receiverThread

      private UDPReceiver.UDPReceiverThread receiverThread
    • encoding

      private String encoding
    • decoder

      private String decoder
    • decoderImpl

      private Decoder decoderImpl
    • paused

      protected boolean paused
    • closed

      private transient boolean closed
    • port

      private int port
    • socket

      private DatagramSocket socket
    • handlerThread

    • advertiseViaMulticastDNS

      private boolean advertiseViaMulticastDNS
    • zeroConf

      private org.apache.log4j.net.ZeroConfSupport zeroConf
    • ZONE

      public static final String ZONE
      The MulticastDNS zone advertised by a UDPReceiver
      See Also:
  • Constructor Details

    • UDPReceiver

      public UDPReceiver()
  • Method Details

    • getPort

      public int getPort()
      Description copied from interface: PortBased
      Returns the Port # that this net based thing is using.
      Specified by:
      getPort in interface PortBased
      Returns:
      int port number
    • setPort

      public void setPort(int port)
    • setEncoding

      public void setEncoding(String encoding)
      The Encoding option specifies how the bytes are encoded. If this option is not specified, the system encoding will be used.
    • getEncoding

      public String getEncoding()
      Returns value of the Encoding option.
    • getDecoder

      public String getDecoder()
    • setDecoder

      public void setDecoder(String decoder)
    • isPaused

      public boolean isPaused()
      Description copied from interface: Pauseable
      Get paused state.
      Specified by:
      isPaused in interface Pauseable
      Returns:
      paused state.
    • setPaused

      public void setPaused(boolean b)
      Description copied from interface: Pauseable
      Set paused state.
      Specified by:
      setPaused in interface Pauseable
      Parameters:
      b - new value
    • setAdvertiseViaMulticastDNS

      public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)
    • isAdvertiseViaMulticastDNS

      public boolean isAdvertiseViaMulticastDNS()
    • shutdown

      public void shutdown()
      Description copied from interface: Plugin
      Call when the plugin should be stopped.
      Specified by:
      shutdown in interface Plugin
    • activateOptions

      public void activateOptions()
      Returns true if this receiver is active.
      Specified by:
      activateOptions in interface org.apache.log4j.spi.OptionHandler