CONTENTS | PREV | NEXT Java Remote Method Invocation


5.10 The LogStream Class

The class LogStream presents a mechanism for logging errors that are of possible interest to those monitoring the system. This class is used internally for server call logging.

package java.rmi.server;

public class LogStream extends java.io.PrintStream {

	public static LogStream log(String name);
	public static synchronized PrintStream getDefaultStream();
	public static synchronized void setDefaultStream(


		PrintStream newDefault);
	public synchronized OutputStream getOutputStream();
	public synchronized void setOutputStream(OutputStream out);
	public void write(int b);
	public void write(byte b[], int off, int len);
	public String toString();
	public static int parseLevel(String s);
	// constants for logging levels
	public static final int SILENT  = 0;
	public static final int BRIEF   = 10;
	public static final int VERBOSE = 20;
}



Note - The LogStream class is deprecated in JDK1.2
The method log returns the LogStream identified by the given name. If a log corresponding to name does not exist, a log using the default stream is created.

The method getDefaultStream returns the current default stream for new logs.

The method setDefaultStream sets the default stream for new logs.

The method getOutputStream returns current stream to which output from this log is sent.

The method setOutputStream sets the stream to which output from this log is sent.

The first form of the method write writes a byte of data to the stream. If it is not a new line, then the byte is appended to the internal buffer. If it is a new line, then the currently buffered line is sent to the log's output stream with the appropriate logging prefix. The second form of the method write writes a subarray of bytes.

The method toString returns log name as string representation.

The method parseLevel converts a string name of a logging level to its internal integer representation.



CONTENTS | PREV | NEXT
Copyright © 1997-1998 Sun Microsystems, Inc. All Rights Reserved.