aspose file tools*
The moose likes Distributed Java and the fly likes RMI Logging - Cryptic output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Logging - Cryptic output" Watch "RMI Logging - Cryptic output" New topic
Author

RMI Logging - Cryptic output

David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
Okay, this might very well be a "Duh" question but I've noticed that when I run my RMI servers, a "log" directory is made with the following files:
Logfile.1
Snapshot.1
Version_Number
Does anyone know what those files are? I would think that they contain RMI logging output but none of the files are in a readable text format.
I need to turn on much of the RMI logging facilities to debug a problem and I'm trying to figure out where and how to read the log files. Any help would be appreciated.
I've never worked with 1.4's logging mechanism before. I use log4j.
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
Well, I found this information: http://user-aecolley.jini.org/#rmi which seems to answer my above questions in regards to the "log" directory.
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
Thanks for posting your solution. It might help someone else who is having the same problem.
Chris
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
A followup on what I've found out for turning on the default RMI logging:
1) Refer to RMI Implementation Logging for the list of RMI logging properties.
2) Pass "-C-Djava.rmi.server.logCalls=true" when you run the rmid program. You might also want to pass "-C-Dsun.rmi.log.debug=true" as well.
An example command looks like:
${JAVA_HOME}/bin/rmid -J-Djava.security.policy=mypolicy.file -C-Djava.rmi.server.logCalls=true -C-Dsun.rmi.log.debug=true &
* Note: This caused the RMI logging output to be printed via System.err on my console window which wasn't very helpful since I wanted it saved to a file. In my search I came across these 2 tidbits in a couple of RMI books:
The easiest way to get the "sun.rmi.*" logs to be saved to a log file is to redirect System.err

You have to set the logging destination before you invoke any RMI methods. Once RMI starts loggging to a particular PrintSteam, it keeps logging to that PrintStream.

Check this link for code on how to redirect to System.err: Redirecting streams
The conclusion:
The code that redirects System.err is run only when a remote method is called, mainly because I'm using Activatable objects (the implementation classes reference a constants class which has a static code block that has the redirection code). Because of that, I can't satisfy the condition stated in the second quote which means I still don't know how to get the RMI logging to be output to a file.
At the very least, I can at least see the RMI log output now.
Hope this helps anyone else.
[ February 18, 2004: Message edited by: David Duran ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI Logging - Cryptic output