org.apache.log4j.receivers.net

## Class UDPReceiver

- java.lang.Object
- - org.apache.log4j.component.spi.ComponentBase
  - - org.apache.log4j.component.plugins.PluginSkeleton
    - - org.apache.log4j.component.plugins.Receiver
      - - org.apache.log4j.receivers.net.UDPReceiver

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

      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.
  Author:
    Scott Deboy

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `paused`
    `static String` | `ZONE` The MulticastDNS zone advertised by a UDPReceiver

    - ### Fields inherited from class org.apache.log4j.component.plugins.Receiver

      `thresholdLevel`

    - ### Fields inherited from class org.apache.log4j.component.plugins.PluginSkeleton

      `active, name`

    - ### Fields inherited from class org.apache.log4j.component.spi.ComponentBase

      `repository`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UDPReceiver()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activateOptions()` Returns true if this receiver is active.
    `String` | `getDecoder()`
    `String` | `getEncoding()` Returns value of the Encoding option.
    `int` | `getPort()` Returns the Port # that this net based thing is using.
    `boolean` | `isAdvertiseViaMulticastDNS()`
    `boolean` | `isPaused()` Get paused state.
    `void` | `setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)`
    `void` | `setDecoder(String decoder)`
    `void` | `setEncoding(String encoding)` The Encoding option specifies how the bytes are encoded.
    `void` | `setPaused(boolean b)` Set paused state.
    `void` | `setPort(int port)`
    `void` | `shutdown()` Call when the plugin should be stopped.

    - ### Methods inherited from class org.apache.log4j.component.plugins.Receiver

      `doPost, getThreshold, isAsSevereAsThreshold, setThreshold`

    - ### Methods inherited from class org.apache.log4j.component.plugins.PluginSkeleton

      `addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, isEquivalent, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName`

    - ### Methods inherited from class org.apache.log4j.component.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.receivers.net.NetworkBased

      `getName, isActive`

- - ### Field Detail

    - #### paused

          protected boolean paused

    - #### ZONE

          public static final String ZONE

      The MulticastDNS zone advertised by a UDPReceiver
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UDPReceiver

          public UDPReceiver()

  - ### Method Detail

    - #### 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`

Copyright © 2013 The Apache Software Foundation. Licensed under the Apache License, Version 2.0

Apache Extras for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.