com.wowza.wms.logging.NetworkBased, com.wowza.wms.logging.PortBasedpublic class UDPAppender
extends org.apache.log4j.AppenderSkeleton
implements com.wowza.wms.logging.PortBased
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.
| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_PORT |
The default port number for the UDP packets, 9991.
|
| Constructor | Description |
|---|---|
UDPAppender() |
|
UDPAppender(String host,
int port) |
Sends UDP packets to the
address and port. |
UDPAppender(java.net.InetAddress address,
int port) |
Sends UDP packets to the
address and port. |
| Modifier and Type | Method | Description |
|---|---|---|
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.
|
String |
getApplication() |
Returns value of the App option.
|
String |
getEncoding() |
Returns value of the Encoding option.
|
int |
getPort() |
Returns value of the Port option.
|
String |
getRemoteHost() |
Returns value of the RemoteHost option.
|
boolean |
isActive() |
|
boolean |
requiresLayout() |
The UDPAppender uses layouts.
|
void |
setApplication(String app) |
The App option takes a string value which should be the name of the application getting logged.
|
void |
setEncoding(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(String host) |
The RemoteHost option takes a string value which should be
the host name or ipaddress to send the UDP packets.
|
public static final int DEFAULT_PORT
public UDPAppender()
public UDPAppender(String host,
int port)
address and port.public UDPAppender(java.net.InetAddress address,
int port)
address and port.public void activateOptions()
activateOptions in class org.apache.log4j.AppenderSkeletonpublic void append(org.apache.log4j.spi.LoggingEvent event)
append in class org.apache.log4j.AppenderSkeletonpublic void cleanUp()
public void close()
This will mark the appender as closed and
call then cleanUp() method.
public String getApplication()
public String getEncoding()
public int getPort()
getPort in interface com.wowza.wms.logging.PortBasedpublic String getRemoteHost()
public boolean isActive()
isActive in interface com.wowza.wms.logging.NetworkBasedpublic boolean requiresLayout()
true.public void setApplication(String app)
public void setEncoding(String encoding)
public void setPort(int port)
public void setRemoteHost(String host)