org.apache.log.output.net
Class DatagramOutputTarget

java.lang.Object
  extended byorg.apache.log.output.AbstractTarget
      extended byorg.apache.log.output.AbstractOutputTarget
          extended byorg.apache.log.output.net.DatagramOutputTarget
All Implemented Interfaces:
Closeable, ErrorAware, LogTarget

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

Constructor Summary
DatagramOutputTarget(java.net.InetAddress address, int port)
          Create a output target with end point specified by address and port.
DatagramOutputTarget(java.net.InetAddress address, int port, Formatter formatter)
          Create a output target with end point specified by address and port.
DatagramOutputTarget(java.net.InetAddress address, int port, Formatter formatter, java.lang.String encoding)
          Create a output target with end point specified by address and port.
 
Method Summary
 void close()
          Shutdown target.
protected  void write(java.lang.String stringData)
          Method to write output to datagram.
 
Methods inherited from class org.apache.log.output.AbstractOutputTarget
doProcessEvent, getFormatter, open
 
Methods inherited from class org.apache.log.output.AbstractTarget
getErrorHandler, isOpen, processEvent, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatagramOutputTarget

public DatagramOutputTarget(java.net.InetAddress address,
                            int port,
                            Formatter formatter,
                            java.lang.String encoding)
                     throws java.io.IOException
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:
java.io.IOException - if an error occurs

DatagramOutputTarget

public DatagramOutputTarget(java.net.InetAddress address,
                            int port,
                            Formatter formatter)
                     throws java.io.IOException
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:
java.io.IOException - if an error occurs

DatagramOutputTarget

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

Parameters:
address - the address endpoint
port - the address port
Throws:
java.io.IOException - if an error occurs
Method Detail

write

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

Overrides:
write in class AbstractOutputTarget
Parameters:
stringData - the data to be output

close

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

Specified by:
close in interface Closeable
Overrides:
close in class AbstractOutputTarget


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.