Save This Page
Home » apache-log4j-1.2.15 » org.apache » log4j » net » [javadoc | source]
org.apache.log4j.net
public class: DatagramStringWriter [javadoc | source]
java.lang.Object
   java.io.Writer
      org.apache.log4j.net.DatagramStringWriter

All Implemented Interfaces:
    Closeable, Flushable, Appendable

DatagramStringWriter is a wrapper around the java.net.DatagramSocket class so that it behaves like a java.io.Writer.
Field Summary
static final  int SYSLOG_PORT     
Constructor:
 public DatagramStringWriter(String host) 
    This constructor assumes that it is sending to a remote syslog daemon on the normal syslog port (514), and uses the default platform character encoding when converting the message string to a byte sequence.
 public DatagramStringWriter(String host,
    int port) 
    This constructor sends messages to the specified host and port, and uses the default platform character encoding when converting the message string to a byte sequence.
 public DatagramStringWriter(String host,
    int port,
    String encoding) 
    This constructor sends messages to the specified host and port, and uses the specified character encoding when converting the message string to a byte sequence.
 public DatagramStringWriter(String host,
    int port,
    String encoding,
    String prefix) 
    This constructor sends messages to the specified host and port, and uses the specified character encoding when converting the message string to a byte sequence; the specified prefix (which may be null) is prepended to each message.
Method from org.apache.log4j.net.DatagramStringWriter Summary:
close,   flush,   setPrefix,   write,   write
Methods from java.io.Writer:
append,   append,   append,   append,   append,   append,   close,   flush,   write,   write,   write,   write,   write
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.net.DatagramStringWriter Detail:
 public  void close() 
 public  void flush() 
 public  void setPrefix(String prefix) 
    Set a string to be prefixed to every message sent by this Writer. For example, this method could be used to prepend a syslog facility/priority code on the front of each message.

    Note that this method is not synchronised, so should not be called in a situation where other threads may be logging messages at the same moment.

 public  void write(String string) throws IOException 
 public  void write(char[] buf,
    int off,
    int len) throws IOException