Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: how to read back the lines printed out to the console? Date: Tue, 31 Jan 2012 11:11:04 -0800 Organization: albasani.net Lines: 32 Message-ID: References: <99599fa8-013c-4132-ac9e-5987d9d5588e@o13g2000vbf.googlegroups.com> <4f2736dd$0$291$14726298@news.sunsite.dk> <3409fa75-d290-4501-80b5-fdb3f798df9a@s9g2000vbc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net Lj4yuRXFXTOeUstgOw6SwS9zJ8PhZRnMHbbu2bEK3jwwAom8DaG4iDNUyVCh4cCCEN0bZb33wsy1PDXsmGpia9SKDE1+He5xNryF+7SvtBRS3YFeac3Kpapgh1dW18DS NNTP-Posting-Date: Tue, 31 Jan 2012 19:11:05 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="f0vyhnwc4zp7HY/9W9Aw/AhJ1E7a3zJYbsyYYuXuXj735wS07nDxaDCt+9WbQPH5BOBPlbHsCEUr8h8uqTQHjsdB6dJv5K70cuoDqeq+cIK6DIkNgVUnXQycR7SCmej6"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111229 Thunderbird/9.0 In-Reply-To: <3409fa75-d290-4501-80b5-fdb3f798df9a@s9g2000vbc.googlegroups.com> Cancel-Lock: sha1:9HVSvDhpd8ODyLQqtxol+lut72E= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11680 On 01/31/2012 10:09 AM, frame wrote: > Wow. Thank you so much. I greatly appreciate your effort for putting > up such complete and nicely formatted code, including testing code. > Thank you very very much. > > Like Patricia said, I am almost there. Based on your code, my class > ends up to be: > > class TeeOutputStream extends OutputStream > { ... > Since now, all System.out.println(..) message is shown on the console > progressively when the program running and be saved into a file at the > end by writing out our logger object to a xml file. > > Thank you again for all the help. This is still far harder, more fragile and less flexible that biting the bullet and *using a logging framework*. In your career you will have to learn when to do the right thing. Doing the wrong thing, although you believe it now to be more expedient, will inevitably bite you in the ass. Hopefully at that time you'll say to yourself, "Well, Lew warned me this was going to happen. I should have listened back then when it was only a simple matter of substituting text in 500 locations instead of having to maintain this kludgey, buggy, large subsystem." -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg