Top Description Fields Constructors Methods
org.apache.log.output.net

public Class DatagramOutputTarget

extends AbstractOutputTarget
Class Inheritance
Imports
java.io.IOException, java.net.DatagramPacket, .DatagramSocket, .InetAddress, org.apache.log.format.Formatter, org.apache.log.output.AbstractOutputTarget

A datagram output target. Useful for writing using custom protocols or writing to syslog daemons.
Authors
Avalon Development Team, Peter Donald

Field Summary

Modifier and TypeField and Description
private static final String
private String
private DatagramSocket

Constructor Summary

AccessConstructor and Description
public
DatagramOutputTarget(final InetAddress
the address endpoint
address
,
final int
the address port
port
,
final Formatter
the message formatter
formatter
,
final String
the encoding to use when encoding string
encoding
)

Create a output target with end point specified by address and port.

public
DatagramOutputTarget(final InetAddress
the address endpoint
address
,
final int
the address port
port
,
final Formatter
the message formatter
formatter
)

Create a output target with end point specified by address and port.

public
DatagramOutputTarget(final InetAddress
the address endpoint
address
,
final int
the address port
port
)

Create a output target with end point specified by address and port.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
protected void
write(final String
the data to be output
stringData
)

Overrides org.apache.log.output.AbstractOutputTarget.write.

Method to write output to datagram.
Inherited from org.apache.log.output.AbstractOutputTarget:
doProcessEventgetFormatteropen

Field Detail

DEFAULT_ENCODINGback to summary
private static final String DEFAULT_ENCODING
m_encodingback to summary
private String m_encoding
m_socketback to summary
private DatagramSocket m_socket

Constructor Detail

DatagramOutputTargetback to summary
public DatagramOutputTarget(final InetAddress address, final int port, final Formatter formatter, final String encoding) throws IOException

Create a output target with end point specified by address and port.

Parameters
address:InetAddress

the address endpoint

port:int

the address port

formatter:Formatter

the message formatter

encoding:String

the encoding to use when encoding string

Exceptions
IOException:
if an error occurs
DatagramOutputTargetback to summary
public DatagramOutputTarget(final InetAddress address, final int port, final Formatter formatter) throws IOException

Create a output target with end point specified by address and port.

Parameters
address:InetAddress

the address endpoint

port:int

the address port

formatter:Formatter

the message formatter

Exceptions
IOException:
if an error occurs
DatagramOutputTargetback to summary
public DatagramOutputTarget(final InetAddress address, final int port) throws IOException

Create a output target with end point specified by address and port.

Parameters
address:InetAddress

the address endpoint

port:int

the address port

Exceptions
IOException:
if an error occurs

Method Detail

closeback to summary
public synchronized void close()

Overrides org.apache.log.output.AbstractOutputTarget.close.

Implements org.apache.log.util.Closeable.close.

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

writeback to summary
protected void write(final String stringData)

Overrides org.apache.log.output.AbstractOutputTarget.write.

Method to write output to datagram.

Parameters
stringData:String

the data to be output