In addition to a distributed garbage collector, the RMI runtime also provides a fairly extensive logging facility that enables you to track the behavior of your applications. Unfortunately, RMI’s logging is somewhat idiosyncratic. There are actually three different types of logs: the standard log, the specialized logs (there are five of these), and the debugging log.
The standard log is
easy to use. You turn it on and off using the
property. This is a boolean system property. Note
that this property can either be set at the
command line or in code. There is no functional
difference between the command line invocation:
java -Djava.rmi.server.logCalls=true [
same other stuff]
to invoke a program that contains the line:
System.getProperties( ).put("java.rmi.server.logCalls", "true");
Actually, this isn’t quite true. At the command line, you always have permission to set system properties. Depending on your security policy, a program might not have permission to do so. We’ll explore this more in Chapter 20.
Once you’ve turned logging on, you need to
set the logging destination. This is done by using
one of the static logging methods defined in the
class, which is defined in the
The methods are:
public static PrintStream getLog( ) public static void setLog(OutputStream out)
The first retrieves the stream currently used to do logging, and the ...