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");
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)