• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to redirect all the eclipse console logs to buffer

 
krishna pradeep
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()));
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some applications may not limit their output to System.out, but also use System.err ...
 
krishna pradeep
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. System.err helped me
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic