Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11634 > unrolled thread

how to read back the lines printed out to the console?

Started byframe <xsli2@yahoo.com>
First post2012-01-30 12:03 -0800
Last post2012-01-31 11:17 -0800
Articles 20 on this page of 29 — 11 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  how to read back the lines printed out to the console? frame <xsli2@yahoo.com> - 2012-01-30 12:03 -0800
    Re: how to read back the lines printed out to the console? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-01-30 20:18 +0000
      Re: how to read back the lines printed out to the console? Roedy Green <see_website@mindprod.com.invalid> - 2012-01-30 20:42 -0800
    Re: how to read back the lines printed out to the console? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-30 14:18 -0800
      Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-30 19:34 -0500
    Re: how to read back the lines printed out to the console? Patricia Shanahan <pats@acm.org> - 2012-01-30 14:37 -0800
      Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-30 20:08 -0500
        Re: how to read back the lines printed out to the console? Patricia Shanahan <pats@acm.org> - 2012-01-30 17:18 -0800
          Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-30 21:00 -0500
    Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-30 19:33 -0500
      Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-30 19:35 -0500
      Re: how to read back the lines printed out to the console? frame <xsli2@yahoo.com> - 2012-01-31 10:09 -0800
        Re: how to read back the lines printed out to the console? Lew <noone@lewscanon.com> - 2012-01-31 11:11 -0800
          Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-31 20:39 -0500
          Re: how to read back the lines printed out to the console? frame <xsli2@yahoo.com> - 2012-02-01 06:01 -0800
            Re: how to read back the lines printed out to the console? Ian Shef <invalid@avoiding.spam> - 2012-02-01 19:15 +0000
              Re: how to read back the lines printed out to the console? frame <xsli2@yahoo.com> - 2012-02-01 12:59 -0800
                Re: how to read back the lines printed out to the console? Gene Wirchenko <genew@ocis.net> - 2012-02-01 14:00 -0800
            Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-01 19:27 -0500
    Re: how to read back the lines printed out to the console? frame <xsli2@yahoo.com> - 2012-01-30 18:49 -0800
      Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-30 21:56 -0500
      Re: how to read back the lines printed out to the console? Patricia Shanahan <pats@acm.org> - 2012-01-30 19:06 -0800
      Re: how to read back the lines printed out to the console? Roedy Green <see_website@mindprod.com.invalid> - 2012-01-30 20:46 -0800
      Re: how to read back the lines printed out to the console? Lew <noone@lewscanon.com> - 2012-01-30 21:18 -0800
        Re: how to read back the lines printed out to the console? Arne Vajhøj <arne@vajhoej.dk> - 2012-01-31 20:36 -0500
      Re: how to read back the lines printed out to the console? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-01-31 10:18 +0200
        Re: how to read back the lines printed out to the console? Lew <noone@lewscanon.com> - 2012-01-31 11:15 -0800
      Re: how to read back the lines printed out to the console? bugbear <bugbear@trim_papermule.co.uk_trim> - 2012-01-31 09:50 +0000
        Re: how to read back the lines printed out to the console? Lew <noone@lewscanon.com> - 2012-01-31 11:17 -0800

Page 1 of 2  [1] 2  Next page →


#11634 — how to read back the lines printed out to the console?

Fromframe <xsli2@yahoo.com>
Date2012-01-30 12:03 -0800
Subjecthow to read back the lines printed out to the console?
Message-ID<99599fa8-013c-4132-ac9e-5987d9d5588e@o13g2000vbf.googlegroups.com>
Hi:

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.

Since there are about 500 calls in the code, we don't want to add a
duplicated printing method at every printing place. I am thinking to
let the program run as usal, printing out all the messages to the
console, then before the program ends, having a method reading in
every line on the console, which was printed out previously. I just
don't know how to achieve that.

Thank you very much.

[toc] | [next] | [standalone]


#11636

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2012-01-30 20:18 +0000
Message-ID<jg6tv7$kr0$1@speranza.aioe.org>
In reply to#11634
frame <xsli2@yahoo.com> 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

[toc] | [prev] | [next] | [standalone]


#11667

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-01-30 20:42 -0800
Message-ID<p9sei7letj00eftdgr62pdl3lgp00q2n8s@4ax.com>
In reply to#11636
On Mon, 30 Jan 2012 20:18:47 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote, quoted or indirectly quoted someone who
said :

>The old-fashioned way on unix is the tee command, which you can pipe
>into, and will write to a file and stdout.

Take Command includes a TEE command.

See http://mindprod.com/jgloss/takecommand.html
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is 
"If you change this, remember to change ?XXX? too".
 

[toc] | [prev] | [next] | [standalone]


#11638

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2012-01-30 14:18 -0800
Message-ID<8HEVq.4480$Qb1.3264@newsfe20.iad>
In reply to#11634
On 1/30/12 12:03 PM, frame wrote:
> Hi:
>
> 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.
>
> Since there are about 500 calls in the code, we don't want to add a
> duplicated printing method at every printing place. I am thinking to
> let the program run as usal, printing out all the messages to the
> console, then before the program ends, having a method reading in
> every line on the console, which was printed out previously. I just
> don't know how to achieve that.
>
> Thank you very much.
>
Perhaps System.out isn't the way to go. You might want to look into 
logging frameworks, such as commons logging or log4j. They provide that 
kind of flexibility and more.

[toc] | [prev] | [next] | [standalone]


#11642

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-01-30 19:34 -0500
Message-ID<4f27372c$0$291$14726298@news.sunsite.dk>
In reply to#11638
On 1/30/2012 5:18 PM, Daniel Pitts wrote:
> On 1/30/12 12:03 PM, 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.
>>
>> Since there are about 500 calls in the code, we don't want to add a
>> duplicated printing method at every printing place. I am thinking to
>> let the program run as usal, printing out all the messages to the
>> console, then before the program ends, having a method reading in
>> every line on the console, which was printed out previously. I just
>> don't know how to achieve that.

> Perhaps System.out isn't the way to go. You might want to look into
> logging frameworks, such as commons logging or log4j. They provide that
> kind of flexibility and more.

If it is a serious program, then that should be the way forward.

If it is a standalone SE app the jul could be an option too.

Arne

[toc] | [prev] | [next] | [standalone]


#11639

FromPatricia Shanahan <pats@acm.org>
Date2012-01-30 14:37 -0800
Message-ID<UIOdnX6ehPINhrrSnZ2dnUVZ_rudnZ2d@earthlink.com>
In reply to#11634
On 1/30/2012 12:03 PM, frame wrote:
> Hi:
>
> 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.
...

Is it really necessary to delay creating the text file until the end?

That complicates things. For example, the simplest way of using the
System.setOut idea would be to write each line to both the old
System.out and a text file at the same time. Similarly, the UNIX tee
command writes its output file as it goes along, not just at the end.

Patricia

[toc] | [prev] | [next] | [standalone]


#11646

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-01-30 20:08 -0500
Message-ID<4f273ef9$0$288$14726298@news.sunsite.dk>
In reply to#11639
On 1/30/2012 8:01 PM, Stefan Ram wrote:
> Patricia Shanahan<pats@acm.org>  writes:
>> Is it really necessary to delay creating the text file until the end?
>
>    I missed that requirement. It might be possible to do this
>    in a thread set with

I somewhat expect that this requirement is not something OP needs
but something that was written because OP thought it should be
done by reading from the console at then end of the run.

Arne

[toc] | [prev] | [next] | [standalone]


#11647

FromPatricia Shanahan <pats@acm.org>
Date2012-01-30 17:18 -0800
Message-ID<ZeydnW4gSvP73LrSnZ2dnUVZ_gudnZ2d@earthlink.com>
In reply to#11646
On 1/30/2012 5:08 PM, Arne Vajhøj wrote:
> On 1/30/2012 8:01 PM, Stefan Ram wrote:
>> Patricia Shanahan<pats@acm.org> writes:
>>> Is it really necessary to delay creating the text file until the end?
>>
>> I missed that requirement. It might be possible to do this
>> in a thread set with
>
> I somewhat expect that this requirement is not something OP needs
> but something that was written because OP thought it should be
> done by reading from the console at then end of the run.
>
> Arne
>

Seems likely, and I hope that is the case.

Patricia

[toc] | [prev] | [next] | [standalone]


#11648

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-01-30 21:00 -0500
Message-ID<4f274b26$0$285$14726298@news.sunsite.dk>
In reply to#11647
On 1/30/2012 8:18 PM, Patricia Shanahan wrote:
> On 1/30/2012 5:08 PM, Arne Vajhøj wrote:
>> On 1/30/2012 8:01 PM, Stefan Ram wrote:
>>> Patricia Shanahan<pats@acm.org> writes:
>>>> Is it really necessary to delay creating the text file until the end?
>>>
>>> I missed that requirement. It might be possible to do this
>>> in a thread set with
>>
>> I somewhat expect that this requirement is not something OP needs
>> but something that was written because OP thought it should be
>> done by reading from the console at then end of the run.
>>
>
> Seems likely, and I hope that is the case.

It could be stashed away in a ByteArrayOutputStream
and written to file later, but it seems so pointless.

Arne

[toc] | [prev] | [next] | [standalone]


#11641

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-01-30 19:33 -0500
Message-ID<4f2736dd$0$291$14726298@news.sunsite.dk>
In reply to#11634
On 1/30/2012 3:03 PM, 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.
>
> Since there are about 500 calls in the code, we don't want to add a
> duplicated printing method at every printing place. I am thinking to
> let the program run as usal, printing out all the messages to the
> console, then before the program ends, having a method reading in
> every line on the console, which was printed out previously. I just
> don't know how to achieve that.

If you can live with the file being written while the
program runs then something like:

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

public class TeeOutputStream extends OutputStream {
	private OutputStream os1;
	private OutputStream os2;
	public TeeOutputStream(OutputStream os1, OutputStream os2) {
		this.os1 = os1;
		this.os2 = os2;
	}
	public void write(byte[] b) throws IOException {
		os1.write(b);
		os2.write(b);
	}
	public void write(byte[] b, int off, int len) throws IOException {
		os1.write(b, off, len);
		os2.write(b, off, len);
	}
	public void write(int b) throws IOException {
		os1.write(b);
		os2.write(b);
	}
	public void flush() throws IOException {
		os1.flush();
		os2.flush();
	}
	public void close() throws IOException {
		os1.close();
		os2.close();
	}
	public static void test2() {
		System.out.println("This is test2");
	}
	public static void test1() {
		System.out.println("This is test1");
	}
	public static void main(String[] args) throws IOException {
		System.out.println("normal");
		PrintStream sav = System.out;
		System.setOut(new PrintStream(new TeeOutputStream(System.out, new 
PrintStream("C:\\work\\tst.out"))));
		test1();
		test2();
		System.setOut(sav);
		System.out.println("normal");
	}
}


Arne

[toc] | [prev] | [next] | [standalone]


#11643

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-01-30 19:35 -0500
Message-ID<4f273758$0$291$14726298@news.sunsite.dk>
In reply to#11641
On 1/30/2012 7:33 PM, Arne Vajhøj wrote:
> On 1/30/2012 3:03 PM, 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.
>>
>> Since there are about 500 calls in the code, we don't want to add a
>> duplicated printing method at every printing place. I am thinking to
>> let the program run as usal, printing out all the messages to the
>> console, then before the program ends, having a method reading in
>> every line on the console, which was printed out previously. I just
>> don't know how to achieve that.
>
> If you can live with the file being written while the
> program runs then something like:
>
> import java.io.IOException;
> import java.io.OutputStream;
> import java.io.PrintStream;
>
> public class TeeOutputStream extends OutputStream {
> private OutputStream os1;
> private OutputStream os2;
> public TeeOutputStream(OutputStream os1, OutputStream os2) {
> this.os1 = os1;
> this.os2 = os2;
> }
> public void write(byte[] b) throws IOException {
> os1.write(b);
> os2.write(b);
> }
> public void write(byte[] b, int off, int len) throws IOException {
> os1.write(b, off, len);
> os2.write(b, off, len);
> }
> public void write(int b) throws IOException {
> os1.write(b);
> os2.write(b);
> }
> public void flush() throws IOException {
> os1.flush();
> os2.flush();
> }
> public void close() throws IOException {
> os1.close();
> os2.close();
> }
> public static void test2() {
> System.out.println("This is test2");
> }
> public static void test1() {
> System.out.println("This is test1");
> }
> public static void main(String[] args) throws IOException {
> System.out.println("normal");
> PrintStream sav = System.out;
> System.setOut(new PrintStream(new TeeOutputStream(System.out, new
> PrintStream("C:\\work\\tst.out"))));
> test1();
> test2();
> System.setOut(sav);
> System.out.println("normal");
> }
> }

If you don't like that approach, then maybe look at some
AspectJ magic.

Arne

[toc] | [prev] | [next] | [standalone]


#11677

Fromframe <xsli2@yahoo.com>
Date2012-01-31 10:09 -0800
Message-ID<3409fa75-d290-4501-80b5-fdb3f798df9a@s9g2000vbc.googlegroups.com>
In reply to#11641
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
{
    private final OutputStream os1;
//    private final OutputStream os2;
    private final Logger _logger;  //the class of Logger is our own
class

    public TeeOutputStream(final OutputStream os1, final Logger log)
    {
        this.os1 = os1;
//        this.os2 = os2;
        this._logger = log;
    }

    @Override
    public void write(final byte[] b) throws IOException
    {
        os1.write(b);
//        os2.write(b);
        this._logger.log(Logger.INFO, new String(b));
    }

    @Override
    public void write(final byte[] b, final int off, final int len)
throws IOException
    {
        os1.write(b, off, len);
//        os2.write(b, off, len);
        this._logger.log(Logger.INFO, new String(b, off, len));
    }

    @Override
    public void write(final int b) throws IOException
    {
        os1.write(b);
//        os2.write(b);
        this._logger.log(Logger.INFO, String.valueOf((char)b));
    }

    @Override
    public void flush() throws IOException
    {
        os1.flush();
//        os2.flush();
    }

    @Override
    public void close() throws IOException
    {
        os1.close();
        this._logger.close();
    }
}

At the place of calling this class,

            final TeeOutputStream teeOutputStream = new
TeeOutputStream(System.out, logger);

            System.setOut(new PrintStream(teeOutputStream));

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.

[toc] | [prev] | [next] | [standalone]


#11680

FromLew <noone@lewscanon.com>
Date2012-01-31 11:11 -0800
Message-ID<jg9ec8$13c$2@news.albasani.net>
In reply to#11677
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

[toc] | [prev] | [next] | [standalone]


#11692

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-01-31 20:39 -0500
Message-ID<4f2897e9$0$283$14726298@news.sunsite.dk>
In reply to#11680
On 1/31/2012 2:11 PM, Lew wrote:
> 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."

I don't think setting out to an instance of a relative simple
class qualifies as "large subsystem".

If they have time, then converting to a logging framework is the
right solution.

If they do not have time, then setting out now and put switching
to a logging framework on the TODO list is the right solution.

We all know that this type of item can be on the TODO list
for years without being implemented, but sometimes the time
is just not there to do the right thing.

Arne

[toc] | [prev] | [next] | [standalone]


#11694

Fromframe <xsli2@yahoo.com>
Date2012-02-01 06:01 -0800
Message-ID<5b9a123d-c912-435d-b13d-4abd7e171053@o12g2000vbd.googlegroups.com>
In reply to#11680
L-E-W:

I bet you have smelled out who I am, even though I have switched my
user name. Let me get things straight here:

1)first, as far as I understand, this Java news group is a public news
group, not *your* private news group. I have the right to join and
post.

2)second, this is a *free* public list, since you have emphasized
before that I have got free answers. If you think I should be charged
for what I am getting here, change the rule of this news group and
make it clear upfront.

3)third, I am not demanding anybody -- including you definitely-- to
answer my questions: if somebody wants to answer, he is more than
welcome to; if he does not want to, that is totally fine.

What I have been done on this Java news group and other news groups
completely follow the rules.

4)This is for you only, please *do not* answer my post. I don't
appreciate any of your posts. To be honest, I have ignored almost all
of them. To me, you are a very old hand of Java, with very little of
understanding of it. Spend your "Java knowledge" somewhere else, ok?

If you have a job with health insurance, I advise you seek mental
health treatment. Killing your time on the internet does not cure your
problem. It makes it worse.

[toc] | [prev] | [next] | [standalone]


#11697

FromIan Shef <invalid@avoiding.spam>
Date2012-02-01 19:15 +0000
Message-ID<Xns9FEC7CC1D66CEvaj4088ianshef@138.125.254.103>
In reply to#11694
frame <xsli2@yahoo.com> wrote in news:5b9a123d-c912-435d-b13d-4abd7e171053
@o12g2000vbd.googlegroups.com:

> L-E-W:
> 
> I bet you have smelled out who I am, even though I have switched my
> user name. Let me get things straight here:
> 
> 1)first, as far as I understand, this Java news group is a public news
> group, not *your* private news group. I have the right to join and
> post.

... and so does Lew !
> 
> 2)second, this is a *free* public list, since you have emphasized
> before that I have got free answers. If you think I should be charged
> for what I am getting here, change the rule of this news group and
> make it clear upfront.

???
> 
> 3)third, I am not demanding anybody -- including you definitely-- to
> answer my questions: if somebody wants to answer, he is more than
> welcome to; if he does not want to, that is totally fine.
> 
> What I have been done on this Java news group and other news groups
> completely follow the rules.
> 
> 4)This is for you only, please *do not* answer my post. I don't
> appreciate any of your posts. To be honest, I have ignored almost all
> of them. To me, you are a very old hand of Java, with very little of
> understanding of it. Spend your "Java knowledge" somewhere else, ok?

Lew is free to post as he sees fit.  He has tremendous knowledge and 
experience with Java.  By ignoring his attempts to help you, you are 
ignoring a powerful resource.  Too bad.


> 
> If you have a job with health insurance, I advise you seek mental
> health treatment. Killing your time on the internet does not cure your
> problem. It makes it worse.
> 

Personal attacks are not helpful.  This one is particularly unfair and out 
of line.

You and Lew are both free to post.  It would be helpful if the postings are 
kept friendly, or at least professional.  A good newsreader will allow you 
to ignore Lew's postings, but you do so at your own "Java peril".


[toc] | [prev] | [next] | [standalone]


#11699

Fromframe <xsli2@yahoo.com>
Date2012-02-01 12:59 -0800
Message-ID<ae12e3f2-f51c-4ea6-9a6c-10208d93d52f@o14g2000vbo.googlegroups.com>
In reply to#11697
On Feb 1, 2:15 pm, Ian Shef <inva...@avoiding.spam> wrote:

>
> Lew is free to post as he sees fit.  He has tremendous knowledge and
> experience with Java.  By ignoring his attempts to help you, you are
> ignoring a powerful resource.  Too bad.
>
>
>
> > If you have a job with health insurance, I advise you seek mental
> > health treatment. Killing your time on the internet does not cure your
> > problem. It makes it worse.
>
> Personal attacks are not helpful.  This one is particularly unfair and out
> of line.
>
> You and Lew are both free to post.  It would be helpful if the postings are
> kept friendly, or at least professional.  A good newsreader will allow you
> to ignore Lew's postings, but you do so at your own "Java peril".

If the OP does not appreciate that person's posting and that person
just insist doing so, that must be some reason of "friendly", "at
least professional" or mental health problem.

[toc] | [prev] | [next] | [standalone]


#11700

FromGene Wirchenko <genew@ocis.net>
Date2012-02-01 14:00 -0800
Message-ID<pbdji71inca6u48m55adjgkt4lja9mr5fc@4ax.com>
In reply to#11699
On Wed, 1 Feb 2012 12:59:51 -0800 (PST), frame <xsli2@yahoo.com>
wrote:

[snip]

>If the OP does not appreciate that person's posting and that person
>just insist doing so, that must be some reason of "friendly", "at
>least professional" or mental health problem.

     I find Lew to be rather brash, but your attacks are over the top.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#11703

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-02-01 19:27 -0500
Message-ID<4f29d86c$0$288$14726298@news.sunsite.dk>
In reply to#11694
On 2/1/2012 9:01 AM, frame wrote:
> L-E-W:
>
> I bet you have smelled out who I am, even though I have switched my
> user name.

I have not.

>                                      Let me get things straight here:
>
> 1)first, as far as I understand, this Java news group is a public news
> group, not *your* private news group. I have the right to join and
> post.

True.

> 2)second, this is a *free* public list, since you have emphasized
> before that I have got free answers. If you think I should be charged
> for what I am getting here, change the rule of this news group and
> make it clear upfront.

True.

> 3)third, I am not demanding anybody -- including you definitely-- to
> answer my questions: if somebody wants to answer, he is more than
> welcome to; if he does not want to, that is totally fine.
>
> What I have been done on this Java news group and other news groups
> completely follow the rules.

True.

> 4)This is for you only, please *do not* answer my post. I don't
> appreciate any of your posts. To be honest, I have ignored almost all
> of them. To me, you are a very old hand of Java, with very little of
> understanding of it. Spend your "Java knowledge" somewhere else, ok?

Try google for killfile.

> If you have a job with health insurance, I advise you seek mental
> health treatment. Killing your time on the internet does not cure your
> problem. It makes it worse.

I think you should take your own advice.

Lew insisted that you should switch to a logging framework.

One can agree or disagree, but it is something that can
be argued.

Your post on the other hand is not good behavior.

Arne

[toc] | [prev] | [next] | [standalone]


#11663

Fromframe <xsli2@yahoo.com>
Date2012-01-30 18:49 -0800
Message-ID<d384ae13-d848-416d-bf13-3f4f8d20a48c@k28g2000yqn.googlegroups.com>
In reply to#11634
Thank you very much for all the replies. Probably I didn't explain my
question clear. After reading all the replies, I am sorry I still
didn't get the idea to proceed.

My problem is such: our finished Java program has many printing
statements, e.g.

System.out.println("step A: everything is ok");
...
System.out.println("step B: computation starts now");
...

if(so)
{
System.out.println("warning: temperature is too hot");
}

There are about 500 of those. When we run the program, all these
messages show up on the console -- that's good. But now, we also want
to keep those messages in a file.  I have two ideas, but none of them
is acceptable:

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.
2)another approach, use log4j to replace those 500 printing statements
-- we are not ready for this approach right now, because there are 500
of them -- in many classes. log4j has different levels(INFO, WARNING,
ERROR etc). We need to analyze every printing case to decide its
level. It is a too big approach for now.

Ideally, I was wondering if this is possible: at the end of the
program, when all those messages have been printed out to the console,
I can added a small piece of code, which will read all the lines on
the console back, then write them into a text file. I don't know if
this makes sense.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web