Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed1.swip.net!newsfeed2.funet.fi!newsfeeds.funet.fi!feeder1.news.elisa.fi!feeder2.news.elisa.fi!fi.sn.net!newsfeed2.tdcnet.fi!news.song.fi!not-for-mail From: Jukka Lahtinen Newsgroups: comp.lang.java.programmer Subject: Re: how to read back the lines printed out to the console? Organization: none References: <99599fa8-013c-4132-ac9e-5987d9d5588e@o13g2000vbf.googlegroups.com> X-no-archive: yes Content-Type: text/plain;charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: Tue, 31 Jan 2012 10:18:23 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:F3dOckzo+RXMK16eULhg5Y5ftFw= MIME-Version: 1.0 Lines: 18 NNTP-Posting-Host: 81.17.207.67 X-Trace: 1327997902 news.tdc.fi 3072 81.17.207.67:39718 X-Complaints-To: abuse@tdcnet.fi Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11673 frame writes: > 1)at the beginning of the program, I added a little piece of code(re- > direct the System output to a file), now all the existing 500 > System.out.println(..) prints to a file, not the console any more -- > this is not good, because the program runs up to 5 hours, we hope to > see the message progressively on the console. With this approach, we > have to wait till the program finished and open the text file to read. Can't you use tail -f on another console (or equivalent for windows)? And of course, other people have suggested replacing System.out with a stream that prints to both console and a file. However, redirecting the output and reading the file simultaneously with tail might be possible without even recompiling the program. -- Jukka Lahtinen