Rice Pastry API

rice.environment.logging
Class LogOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by rice.environment.logging.LogOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class LogOutputStream
extends java.io.OutputStream

This class constructs an output stream that will send its output to a logger, line by line. This could for example be wrapped in a PrintStream to capture stdout or stderr to the log. As so: System.setOut(new PrintStream(new LogOutputStream(environment, Logger.INFO, "out"), true)); System.setErr(new PrintStream(new LogOutputStream(environment, Logger.INFO, "err"), true));

Author:
jstewart

Field Summary
protected  byte[] buffer
           
static int BUFFER_SIZE
           
protected  int level
           
protected  Logger logger
           
protected  int offset
           
 
Constructor Summary
LogOutputStream(Environment env, int level)
          Constructs a LogOutputStream
LogOutputStream(Environment env, int level, java.lang.String instance)
          Constructs a LogOutputStream
 
Method Summary
 void close()
           
 void flush()
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger

buffer

protected byte[] buffer

offset

protected int offset

level

protected int level

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

LogOutputStream

public LogOutputStream(Environment env,
                       int level)
Constructs a LogOutputStream

Parameters:
env - - the environment to log to
level - - the log level of this OutputStream's messages

LogOutputStream

public LogOutputStream(Environment env,
                       int level,
                       java.lang.String instance)
Constructs a LogOutputStream

Parameters:
env - - the environment to log to
level - - the log level of this OutputStream's messages
instance - - an instance name string for disambiguation
Method Detail

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection