Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!gegeweb.42!gegeweb.eu!gegeweb.org!aioe.org!.POSTED!not-for-mail From: glen herrmannsfeldt Newsgroups: comp.lang.java.programmer Subject: Re: how to read back the lines printed out to the console? Date: Mon, 30 Jan 2012 20:18:47 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 17 Message-ID: References: <99599fa8-013c-4132-ac9e-5987d9d5588e@o13g2000vbf.googlegroups.com> NNTP-Posting-Host: H0vc4U5LIRkRHNPyGCs2dA.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: tin/1.9.6-20100522 ("Lochruan") (UNIX) (Linux/2.6.32-5-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11636 frame wrote: > We have an existing Java program, which prints out a lot of message > using System.out.println() method to the console. There are about 500 > those calls in the code. We hope to add one more feature: besides > print out to the console as it is doing now, we also want to store > those messages in a text file. So the message will be in two places: > one place -- the console -- is shown the message progressively as the > program is running; another place -- a text file -- is created at the > end of the program. The old-fashioned way on unix is the tee command, which you can pipe into, and will write to a file and stdout. It should be easy to port to other systems with pipe, such as Windows. -- glen