How do I debug RMI programs, where different pieces are running all over the place? Can I do remote debugging?

Steven Newton

One useful way to do this is to create a remote tracing facility. A simple class that communicates with a central server logging facility using a static method (somewhat like the Unix syslog protocol) can be included on both the client and remote side. Along with this you may wish to define an unchecked subclass of RuntimeException TraceableException which your code can throw, and in the constructor for the exception contact the log server and log the error. Something like:

public class TraceFacility {
     public static trace(Exception e, String message) {
          // send stacktrace and message to central log server here

public class TraceableException extends RuntimeException {
     public TraceableException(String msg) {
          TraceFacility.trace(this, msg);