File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Unable to redirect all the eclipse console logs to buffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Unable to redirect all the eclipse console logs to buffer" Watch "Unable to redirect all the eclipse console logs to buffer" New topic
Author

Unable to redirect all the eclipse console logs to buffer

krishna pradeep
Greenhorn

Joined: May 24, 2006
Posts: 25
I need to assert some string present in the console logs. I tried the below code to redirect the console logs to buffer. However, still some part of the code goes to console logs and I am unable to assert it programatically. Could someone help me here ?

System.setOut( new PrintStream(new ByteArrayOutputStream()));


Pradeep<br /> <br />SCJP 1.4, SCWCD 1.4 , SCBCD 1.3
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Do you need to do it programatically ? In Eclipse, go to Run->Run Configurations... Select your application in the list, go to Common/Standard Input and Output, and select the file you want the standard output to redirected to. Of course, this will only work for applications launched within Eclipse.


[My Blog]
All roads lead to JavaRanch
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
Some applications may not limit their output to System.out, but also use System.err ...


Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
krishna pradeep
Greenhorn

Joined: May 24, 2006
Posts: 25
Thanks. System.err helped me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to redirect all the eclipse console logs to buffer