org.apache.log.output.net

Class DatagramOutputTarget

public class DatagramOutputTarget extends AbstractOutputTarget

A datagram output target. Useful for writing using custom protocols or writing to syslog daemons.

Author: Avalon Development Team Peter Donald

Field Summary
static StringDEFAULT_ENCODING
Stringm_encoding
DatagramSocketm_socket
Constructor Summary
DatagramOutputTarget(InetAddress address, int port, Formatter formatter, String encoding)
Create a output target with end point specified by address and port.
DatagramOutputTarget(InetAddress address, int port, Formatter formatter)
Create a output target with end point specified by address and port.
DatagramOutputTarget(InetAddress address, int port)
Create a output target with end point specified by address and port.
Method Summary
voidclose()
Shutdown target.
protected voidwrite(String stringData)
Method to write output to datagram.

Field Detail

DEFAULT_ENCODING

private static final String DEFAULT_ENCODING

m_encoding

private String m_encoding

m_socket

private DatagramSocket m_socket

Constructor Detail

DatagramOutputTarget

public DatagramOutputTarget(InetAddress address, int port, Formatter formatter, String encoding)
Create a output target with end point specified by address and port.

Parameters: address the address endpoint port the address port formatter the message formatter encoding the encoding to use when encoding string

Throws: IOException if an error occurs

DatagramOutputTarget

public DatagramOutputTarget(InetAddress address, int port, Formatter formatter)
Create a output target with end point specified by address and port.

Parameters: address the address endpoint port the address port formatter the message formatter

Throws: IOException if an error occurs

DatagramOutputTarget

public DatagramOutputTarget(InetAddress address, int port)
Create a output target with end point specified by address and port.

Parameters: address the address endpoint port the address port

Throws: IOException if an error occurs

Method Detail

close

public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.

write

protected void write(String stringData)
Method to write output to datagram.

Parameters: stringData the data to be output