Syslog: White Paper FAQ Examples JavaDoc
Protomatter Classes v1.1.6

com.protomatter.syslog
Class SyslogWriter

java.lang.Object
  |
  +--java.io.Writer
        |
        +--com.protomatter.syslog.SyslogWriter

public class SyslogWriter
extends java.io.Writer

A Writer that is attached to Syslog. When data is flushed, any information built up is sent off to Syslog. Generally, this object will be wrapped with a PrintWriter object for easier use, like this:

SyslogWriter sw = new SyslogWriter(someOtherObject, Syslog.INFO);
PrintWriter pw = new PrintWriter(sw, true);
...
pw.println("Blah blah blah.. this will go to Syslog");
The pw.println(...) call is equivalent to calling:

Syslog.info(someOtherObject, "Blah blah blah.. this will go to Syslog");

See Also:
Syslog

Fields inherited from class java.io.Writer
lock
 
Constructor Summary
SyslogWriter(java.lang.Object logger, int level)
          Create a new SyslogWriter.
SyslogWriter(java.lang.Object logger, java.lang.Object channel, int level)
          Create a new SyslogWriter.
 
Method Summary
 void close()
          Close the writer.
 void flush()
          Flush unwritten data to Syslog.
 void write(char[] buf, int offset, int length)
          Write the given data to the writer.
 
Methods inherited from class java.io.Writer
write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyslogWriter

public SyslogWriter(java.lang.Object logger,
                    int level)
Create a new SyslogWriter. Messages will be written to Syslog as if they came from the given logger, and will be logged at the given level on the default channel.
Parameters:
logger - The object the log messages should appear to come from.
level - The message severity.

SyslogWriter

public SyslogWriter(java.lang.Object logger,
                    java.lang.Object channel,
                    int level)
Create a new SyslogWriter. Messages will be written to Syslog as if they came from the given logger, and will be logged at the given level on given channel (or set of channels).
Parameters:
logger - The object the log messages should appear to come from.
channel - The channel to write messages to (a String or String[]).
level - The message severity.
Method Detail

close

public void close()
Close the writer.
Overrides:
close in class java.io.Writer

flush

public void flush()
Flush unwritten data to Syslog. If the data is longer than 60 characters, then the first 60 characters (up to the first line separator, with "..." appended) are written as the "message" in Syslog, and the entire piece of data is written as the "detail".
Overrides:
flush in class java.io.Writer

write

public void write(char[] buf,
                  int offset,
                  int length)
Write the given data to the writer.
Overrides:
write in class java.io.Writer

Protomatter Classes v1.1.6
Copyright 1998-2001 Nate Sammons

Protomatter Classes v1.1.6 http://protomatter.sourceforge.net/1.1.6