Reputation: 10241
I have a funny requirement here, I have an already existing java program for which I have to write an automation in java. I have to show the merged output for both the programs as a report.
The output should be somewhat like this:
Output from program1 after executing line1
Output from myAutomation after executing line1
Output from program1 after executing line2
Output from myAutomation after executing line2
Output from program1 after executing line2
Output from myAutomation after executing line2
How can I achieve this in java? AFAIK, each java program runs separately in JVM and is isolated, so is this kind of stuff possible at all?
Upvotes: 0
Views: 300
Reputation: 1441
A solution would be to use log4j and redirect the console output of the existing program to a file, and also configure the other program to output on the same file.
Upvotes: 0
Reputation: 5709
You make a very vague question, and without any code it might be a bit hard to answer your question.
My suggestion would be that you merge the two applications. You treat them as two individual objects, that both answers to one controller. If you can't, then I am a bit at a loss. Another option would be, that both programs write to the same file, and then you sort the outputs from the file.
Upvotes: 1