Top Description Inners Fields Constructors Methods
sun.rmi.runtime

public abstract Class Log

extends Object
Class Inheritance
Known Direct Subclasses
sun.rmi.runtime.Log.LoggerLog, sun.rmi.runtime.Log.LogStreamLog
Annotations
@SuppressWarnings:deprecation
Imports
java.io.ByteArrayOutputStream, .PrintStream, .OutputStream, java.lang.StackWalker.StackFrame, java.rmi.server.LogStream, java.security.PrivilegedAction, java.util.Set, java.util.logging.Handler, .SimpleFormatter, .Level, .Logger, .LogRecord, .StreamHandler

Utility which provides an abstract "logger" like RMI internal API which can be directed to use one of two types of logging infrastructure: the java.util.logging API or the java.rmi.server.LogStream API. The default behavior is to use the java.util.logging API. The LogStream API may be used instead by setting the system property sun.rmi.log.useOld to true. For backwards compatibility, supports the RMI system logging properties which pre-1.4 comprised the only way to configure RMI logging. If the java.util.logging API is used and RMI system log properties are set, the system properties override initial RMI logger values as appropriate. If the java.util.logging API is turned off, pre-1.4 logging behavior is used.
Author
Laird Dornin
Since
1.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
Log.InternalStreamHandler

Subclass of StreamHandler for redirecting log output.

private static interface
Log.LogFactory

factory interface enables Logger and LogStream implementations

private static class
Log.LoggerLog

Class specialized to log messages to the java.util.logging API

private static class
Log.LoggerLogFactory

Factory to create Log objects which deliver log messages to the java.util.logging API.

private static class
Log.LoggerPrintStream

PrintStream which forwards log messages to the logger.

private static class
Log.LogStreamLog

Class specialized to log messages to the java.rmi.server.LogStream API

private static class
Log.LogStreamLogFactory

Factory to create Log objects which deliver log messages to the java.rmi.server.LogStream API

Field Summary

Modifier and TypeField and Description
public static final Level
BRIEF

Logger re-definition of old RMI log values

private static final Log.LogFactory
public static final Level
private static final StackWalker

Constructor Summary

AccessConstructor and Description
public
Log()

Method Summary

Modifier and TypeMethod and Description
public static Log
getLog(String loggerName, String oldLogName, int override)

Access log for a tri-state system property.

public static Log
getLog(String loggerName, String oldLogName, boolean override)

Access logs associated with boolean properties Do not call getLog multiple times on the same logger name.

public abstract PrintStream
private static StackWalker.StackFrame
getSource()

Obtain stack frame of code calling a log method.

public abstract boolean
isLoggable(Level level)

"logger like" API to be used by RMI implementation

public abstract void
log(Level level, String message)

public abstract void
log(Level level, String message, Throwable thrown)

public abstract void
setOutputStream(OutputStream stream)

get and set the RMI server call output stream

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BRIEFback to summary
public static final Level BRIEF

Logger re-definition of old RMI log values

logFactoryback to summary
private static final Log.LogFactory logFactory
VERBOSEback to summary
public static final Level VERBOSE
WALKERback to summary
private static final StackWalker WALKER

Constructor Detail

Logback to summary
public Log()

Method Detail

getLogback to summary
public static Log getLog(String loggerName, String oldLogName, int override)

Access log for a tri-state system property. Need to first convert override value to a log level, taking care to interpret a range of values between BRIEF, VERBOSE and SILENT. An override < 0 is interpreted to mean that the logging configuration should not be overridden. The level passed to the factories createLog method will be null in this case. Note that if oldLogName is null and old logging is on, the returned LogStreamLog will ignore the override parameter - the log will never log messages. This permits new logs that only write to Loggers to do nothing when old logging is active. Do not call getLog multiple times on the same logger name. Since this is an internal API, no checks are made to ensure that multiple logs do not exist for the same logger.

getLogback to summary
public static Log getLog(String loggerName, String oldLogName, boolean override)

Access logs associated with boolean properties Do not call getLog multiple times on the same logger name. Since this is an internal API, no checks are made to ensure that multiple logs do not exist for the same logger.

getPrintStreamback to summary
public abstract PrintStream getPrintStream()
getSourceback to summary
private static StackWalker.StackFrame getSource()

Obtain stack frame of code calling a log method.

isLoggableback to summary
public abstract boolean isLoggable(Level level)

"logger like" API to be used by RMI implementation

logback to summary
public abstract void log(Level level, String message)
logback to summary
public abstract void log(Level level, String message, Throwable thrown)
setOutputStreamback to summary
public abstract void setOutputStream(OutputStream stream)

get and set the RMI server call output stream

sun.rmi.runtime back to summary

private Class Log.InternalStreamHandler

extends StreamHandler
Class Inheritance

Subclass of StreamHandler for redirecting log output. flush must be called in the publish and close methods.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.util.logging.StreamHandler.close.

Close the current output stream.

public void
publish(LogRecord
description of the log event. A null record is silently ignored and is not published
record
)

Overrides java.util.logging.StreamHandler.publish.

Format and publish a LogRecord.

Inherited from java.util.logging.StreamHandler:
flushisLoggablesetEncodingsetOutputStream

Constructor Detail

InternalStreamHandlerback to summary
pack-priv InternalStreamHandler(OutputStream out)

Method Detail

closeback to summary
public void close()

Overrides java.util.logging.StreamHandler.close.

Doc from java.util.logging.StreamHandler.close.

Close the current output stream.

The Formatter's "tail" string is written to the stream before it is closed. In addition, if the Formatter's "head" string has not yet been written to the stream, it will be written before the "tail" string.

publishback to summary
public void publish(LogRecord record)

Overrides java.util.logging.StreamHandler.publish.

Doc from java.util.logging.StreamHandler.publish.

Format and publish a LogRecord.

The StreamHandler first checks if there is an OutputStream and if the given LogRecord has at least the required log level. If not it silently returns. If so, it calls any associated Filter to check if the record should be published. If so, it calls its Formatter to format the record and then writes the result to the current output stream.

If this is the first LogRecord to be written to a given OutputStream, the Formatter's "head" string is written to the stream before the LogRecord is written.

Parameters
record:LogRecord

description of the log event. A null record is silently ignored and is not published

sun.rmi.runtime back to summary

private Interface Log.LogFactory

Known Direct Implementers
sun.rmi.runtime.Log.LoggerLogFactory, sun.rmi.runtime.Log.LogStreamLogFactory

factory interface enables Logger and LogStream implementations

Method Summary

Modifier and TypeMethod and Description
public Log
createLog(String loggerName, String oldLogName, Level level)

Method Detail

createLogback to summary
public Log createLog(String loggerName, String oldLogName, Level level)
sun.rmi.runtime back to summary

private Class Log.LoggerLog

extends Log
Class Inheritance

Class specialized to log messages to the java.util.logging API

Field Summary

Modifier and TypeField and Description
private static final Handler
private Log.InternalStreamHandler
copyHandler

handler to which messages are copied

private final Logger
private Log.LoggerPrintStream
Inherited from sun.rmi.runtime.Log:
BRIEFVERBOSE

Constructor Summary

AccessConstructor and Description
private
LoggerLog(final Logger logger, final Level level)

creates a Log which will delegate to the given logger

Method Summary

Modifier and TypeMethod and Description
public synchronized PrintStream
public boolean
isLoggable(Level level)

Implements abstract sun.rmi.runtime.Log.isLoggable.

"logger like" API to be used by RMI implementation

public void
log(Level level, String message)

Implements abstract sun.rmi.runtime.Log.log.

public void
log(Level level, String message, Throwable thrown)

Implements abstract sun.rmi.runtime.Log.log.

public synchronized void
setOutputStream(OutputStream out)

Implements abstract sun.rmi.runtime.Log.setOutputStream.

Set the output stream associated with the RMI server call logger.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from sun.rmi.runtime.Log:
getLoggetLog

Field Detail

alternateConsoleback to summary
private static final Handler alternateConsole
Annotations
@SuppressWarnings:removal
copyHandlerback to summary
private Log.InternalStreamHandler copyHandler

handler to which messages are copied

loggerback to summary
private final Logger logger
loggerSandwichback to summary
private Log.LoggerPrintStream loggerSandwich

Constructor Detail

LoggerLogback to summary
private LoggerLog(final Logger logger, final Level level)

creates a Log which will delegate to the given logger

Annotations
@SuppressWarnings:removal

Method Detail

getPrintStreamback to summary
public synchronized PrintStream getPrintStream()

Implements abstract sun.rmi.runtime.Log.getPrintStream.

isLoggableback to summary
public boolean isLoggable(Level level)

Implements abstract sun.rmi.runtime.Log.isLoggable.

Doc from sun.rmi.runtime.Log.isLoggable.

"logger like" API to be used by RMI implementation

logback to summary
public void log(Level level, String message)

Implements abstract sun.rmi.runtime.Log.log.

logback to summary
public void log(Level level, String message, Throwable thrown)

Implements abstract sun.rmi.runtime.Log.log.

setOutputStreamback to summary
public synchronized void setOutputStream(OutputStream out)

Implements abstract sun.rmi.runtime.Log.setOutputStream.

Set the output stream associated with the RMI server call logger. Calling code needs LoggingPermission "control".

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

sun.rmi.runtime back to summary

private Class Log.LoggerLogFactory

extends Object
implements LogFactory
Class Inheritance
All Implemented Interfaces
sun.rmi.runtime.Log.LogFactory

Factory to create Log objects which deliver log messages to the java.util.logging API.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Log
createLog(final String loggerName, String oldLogName, final Level level)

Implements sun.rmi.runtime.Log.LogFactory.createLog.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LoggerLogFactoryback to summary
pack-priv LoggerLogFactory()

Method Detail

createLogback to summary
public Log createLog(final String loggerName, String oldLogName, final Level level)

Implements sun.rmi.runtime.Log.LogFactory.createLog.

sun.rmi.runtime back to summary

private Class Log.LoggerPrintStream

extends PrintStream
Class Inheritance

PrintStream which forwards log messages to the logger. Class is needed to maintain backwards compatibility with RemoteServer.{set|get}Log().

Field Summary

Modifier and TypeField and Description
private final ByteArrayOutputStream
bufOut

stream used for buffering lines

private int
last

record the last character written to this stream

private final Logger
logger

logger where output of this log is sent

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
write(int
The byte to be written
b
)

Overrides java.io.PrintStream.write.

Writes the specified byte to this stream.

public void
write(byte[]
A byte array
b
,
int
Offset from which to start taking bytes
off
,
int
Number of bytes to write
len
)

Overrides java.io.PrintStream.write.

Writes len bytes from the specified byte array starting at offset off to this stream.

Inherited from java.io.PrintStream:
appendappendappendcharsetcheckErrorclearErrorcloseflushformatformatprintprintprintprintprintprintprintprintprintprintfprintfprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnsetErrorwritewriteBytes

Field Detail

bufOutback to summary
private final ByteArrayOutputStream bufOut

stream used for buffering lines

lastback to summary
private int last

record the last character written to this stream

loggerback to summary
private final Logger logger

logger where output of this log is sent

Constructor Detail

LoggerPrintStreamback to summary
private LoggerPrintStream(Logger logger)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

writeback to summary
public void write(int b)

Overrides java.io.PrintStream.write.

Doc from java.io.PrintStream.write.

Writes the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then the flush method will be invoked on the underlying output stream.

Note that the byte is written as given; to write a character that will be translated according to the default charset, use the print(char) or println(char) methods.

Parameters
b:int

The byte to be written

writeback to summary
public void write(byte[] b, int off, int len)

Overrides java.io.PrintStream.write.

Doc from java.io.PrintStream.write.

Writes len bytes from the specified byte array starting at offset off to this stream. If automatic flushing is enabled then the flush method will be invoked on the underlying output stream.

Note that the bytes will be written as given; to write characters that will be translated according to the default charset, use the print(char) or println(char) methods.

Parameters
b:byte[]

A byte array

off:int

Offset from which to start taking bytes

len:int

Number of bytes to write

sun.rmi.runtime back to summary

private Class Log.LogStreamLog

extends Log
Class Inheritance

Class specialized to log messages to the java.rmi.server.LogStream API

Field Summary

Modifier and TypeField and Description
private int
levelValue

the level of the log as set by associated property

private final LogStream
stream

References Deprecated LogStream is deprecated or references (maybe indirectly) at least one deprecated element.
Log stream to which log messages are written
Inherited from sun.rmi.runtime.Log:
BRIEFVERBOSE

Constructor Summary

AccessConstructor and Description
private
LogStreamLog(LogStream stream, Level level)
References Deprecated LogStream is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
public PrintStream
public synchronized boolean
isLoggable(Level level)

Implements abstract sun.rmi.runtime.Log.isLoggable.

"logger like" API to be used by RMI implementation

public void
log(Level messageLevel, String message)

Implements abstract sun.rmi.runtime.Log.log.

public void
log(Level level, String message, Throwable thrown)

Implements abstract sun.rmi.runtime.Log.log.

public synchronized void
setOutputStream(OutputStream out)

Implements abstract sun.rmi.runtime.Log.setOutputStream.

get and set the RMI server call output stream

private static String
Inherited from sun.rmi.runtime.Log:
getLoggetLog

Field Detail

levelValueback to summary
private int levelValue

the level of the log as set by associated property

streamback to summary
private final LogStream stream

References Deprecated

LogStream is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Log stream to which log messages are written

Constructor Detail

LogStreamLogback to summary
private LogStreamLog(LogStream stream, Level level)

References Deprecated

LogStream is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

getPrintStreamback to summary
public PrintStream getPrintStream()

Implements abstract sun.rmi.runtime.Log.getPrintStream.

isLoggableback to summary
public synchronized boolean isLoggable(Level level)

Implements abstract sun.rmi.runtime.Log.isLoggable.

Doc from sun.rmi.runtime.Log.isLoggable.

"logger like" API to be used by RMI implementation

logback to summary
public void log(Level messageLevel, String message)

Implements abstract sun.rmi.runtime.Log.log.

logback to summary
public void log(Level level, String message, Throwable thrown)

Implements abstract sun.rmi.runtime.Log.log.

setOutputStreamback to summary
public synchronized void setOutputStream(OutputStream out)

Implements abstract sun.rmi.runtime.Log.setOutputStream.

Doc from sun.rmi.runtime.Log.setOutputStream.

get and set the RMI server call output stream

unqualifiedNameback to summary
private static String unqualifiedName(String name)
sun.rmi.runtime back to summary

private Class Log.LogStreamLogFactory

extends Object
implements LogFactory
Class Inheritance
All Implemented Interfaces
sun.rmi.runtime.Log.LogFactory

Factory to create Log objects which deliver log messages to the java.rmi.server.LogStream API

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Log
createLog(String loggerName, String oldLogName, Level level)

Implements sun.rmi.runtime.Log.LogFactory.createLog.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LogStreamLogFactoryback to summary
pack-priv LogStreamLogFactory()

Method Detail

createLogback to summary
public Log createLog(String loggerName, String oldLogName, Level level)

Implements sun.rmi.runtime.Log.LogFactory.createLog.