0

I am writing a client-server application using Java RMI.

Now, my question is I have multiple clients and a server, to see some communication, I have System.out.println statements (SOPs) in both client and servers, but I see all the outputs on just one console, is there a way to view them separately?

To clarify it further let me give you a simple example,

**Server**
void callServer(){
System.out.println("Server is called");
}


**Client**
void callClient(){
System.out.println("Client is called");
server.callServer();
}


**Simulator**  
main(){ 
//create RegistryServer
//create server instance
//create client instance
System.out.println("Sim Started");
client.callClient();
}

OUTPUT of Sim
Sim Started
Client is called
Server is called

Desired Output
Sim Console: Sim Started

Client Console: Client is called

Server Console: Server is called

Is it possible?

hooknc
  • 4,854
  • 5
  • 31
  • 60
Eternal Noob
  • 2,717
  • 5
  • 27
  • 41
  • Just to make sure, you want to pipe all output to one single place and preface the start of the written line with which program is doing the writing? Or do you want the output to be written in separate locations? – John Kane Apr 12 '11 at 20:38
  • No, I want to open three windows/consoles and each should show their SOPs... – Eternal Noob Apr 12 '11 at 20:40
  • pls clarify the setup you want: how many processes, how do they communicate? how many consoles, what should be in them? – Asaf Apr 12 '11 at 21:31

1 Answers1

2

Do you have the client and server separated in different applications or are you running them both from one. If you have them separated you can just run them each in separate terminals and writing to standard out would print the output of each application to its own terminal.

John Kane
  • 4,383
  • 1
  • 24
  • 42
  • Running separated would give me different consoles but is there a way to have separate consoles using just one application? – Eternal Noob Apr 12 '11 at 20:56
  • does that one application acts as both the client and the server, but with RMI calls from/to itself? – Asaf Apr 12 '11 at 21:33