org.apache.log4j.net
クラス UDPAppender

java.lang.Object
  上位を拡張 org.apache.log4j.AppenderSkeleton
      上位を拡張 org.apache.log4j.net.UDPAppender
すべての実装されたインタフェース:
org.apache.log4j.Appender, NetworkBased, PortBased, org.apache.log4j.spi.OptionHandler

public class UDPAppender
extends org.apache.log4j.AppenderSkeleton
implements PortBased

Sends log information as a UDP datagrams.

The UDPAppender is meant to be used as a diagnostic logging tool so that logging can be monitored by a simple UDP client.

Messages are not sent as LoggingEvent objects but as text after applying the designated Layout.

The port and remoteHost properties can be set in configuration properties. By setting the remoteHost to a broadcast address any number of clients can listen for log messages.

This was inspired and really extended/copied from SocketAppender. Please see the docs for the proper credit to the authors of that class.

作成者:
Kevin Brown, Scott Deboy

フィールドの概要
static int DEFAULT_PORT
          The default port number for the UDP packets, 9991.
static java.lang.String ZONE
          The MulticastDNS zone advertised by a UDPAppender
 
クラス org.apache.log4j.AppenderSkeleton から継承されたフィールド
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
コンストラクタの概要
UDPAppender()
           
UDPAppender(java.net.InetAddress address, int port)
          Sends UDP packets to the address and port.
UDPAppender(java.lang.String host, int port)
          Sends UDP packets to the address and port.
 
メソッドの概要
 void activateOptions()
          Open the UDP sender for the RemoteHost and Port.
 void append(org.apache.log4j.spi.LoggingEvent event)
           
 void cleanUp()
          Close the UDP Socket and release the underlying connector thread if it has been created
 void close()
          Close this appender.
 java.lang.String getApplication()
          Returns value of the App option.
 java.lang.String getEncoding()
          Returns value of the Encoding option.
 int getPort()
          Returns value of the Port option.
 java.lang.String getRemoteHost()
          Returns value of the RemoteHost option.
 boolean isActive()
          Get if item is active.
 boolean isAdvertiseViaMulticastDNS()
           
 boolean requiresLayout()
          The UDPAppender uses layouts.
 void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)
           
 void setApplication(java.lang.String app)
          The App option takes a string value which should be the name of the application getting logged.
 void setEncoding(java.lang.String encoding)
          The Encoding option specifies how the bytes are encoded.
 void setPort(int port)
          The Port option takes a positive integer representing the port where UDP packets will be sent.
 void setRemoteHost(java.lang.String host)
          The RemoteHost option takes a string value which should be the host name or ipaddress to send the UDP packets.
 
クラス org.apache.log4j.AppenderSkeleton から継承されたメソッド
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
クラス java.lang.Object から継承されたメソッド
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
インタフェース org.apache.log4j.net.NetworkBased から継承されたメソッド
getName
 

フィールドの詳細

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port number for the UDP packets, 9991.

関連項目:
定数フィールド値

ZONE

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

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

UDPAppender

public UDPAppender()

UDPAppender

public UDPAppender(java.net.InetAddress address,
                   int port)
Sends UDP packets to the address and port.


UDPAppender

public UDPAppender(java.lang.String host,
                   int port)
Sends UDP packets to the address and port.

メソッドの詳細

activateOptions

public void activateOptions()
Open the UDP sender for the RemoteHost and Port.

定義:
インタフェース org.apache.log4j.spi.OptionHandler 内の activateOptions
オーバーライド:
クラス org.apache.log4j.AppenderSkeleton 内の activateOptions

close

public void close()
Close this appender.

This will mark the appender as closed and call then cleanUp() method.

定義:
インタフェース org.apache.log4j.Appender 内の close

cleanUp

public void cleanUp()
Close the UDP Socket and release the underlying connector thread if it has been created


append

public void append(org.apache.log4j.spi.LoggingEvent event)
定義:
クラス org.apache.log4j.AppenderSkeleton 内の append

isActive

public boolean isActive()
インタフェース NetworkBased の記述:
Get if item is active.

定義:
インタフェース NetworkBased 内の isActive
戻り値:
if true, item is active.

requiresLayout

public boolean requiresLayout()
The UDPAppender uses layouts. Hence, this method returns true.

定義:
インタフェース org.apache.log4j.Appender 内の requiresLayout

setRemoteHost

public void setRemoteHost(java.lang.String host)
The RemoteHost option takes a string value which should be the host name or ipaddress to send the UDP packets.


getRemoteHost

public java.lang.String getRemoteHost()
Returns value of the RemoteHost option.


setApplication

public void setApplication(java.lang.String app)
The App option takes a string value which should be the name of the application getting logged. If property was already set (via system property), don't set here.


getApplication

public java.lang.String getApplication()
Returns value of the App option.


setEncoding

public void setEncoding(java.lang.String encoding)
The Encoding option specifies how the bytes are encoded. If this option is not specified, the System encoding is used.


getEncoding

public java.lang.String getEncoding()
Returns value of the Encoding option.


setPort

public void setPort(int port)
The Port option takes a positive integer representing the port where UDP packets will be sent.


getPort

public int getPort()
Returns value of the Port option.

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

setAdvertiseViaMulticastDNS

public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)

isAdvertiseViaMulticastDNS

public boolean isAdvertiseViaMulticastDNS()


Copyright © 2010 Apache Software Foundation. All Rights Reserved.