From: Angel Tsankov on
Hello,

Is there any convention as to what messages should go to stdout and what to
stderr? More specifically, where should I log errors that do not prevent the
program from finishing what it is doing?

Regards,
Angel Tsankov


From: Lew Pitcher on
In comp.unix.programmer, Angel Tsankov wrote:

> Hello,
>
> Is there any convention as to what messages should go to stdout and what
> to stderr? More specifically, where should I log errors that do not
> prevent the program from finishing what it is doing?

You should use stdout for the 'normal' output of your program, and stderr
for /any/ diagnostic messages.

Think of it this way: in a successful run, you only want stdout to contain
data that can be piped in to the next program in the stream. For an
unsuccessful run, stdout should not contain data that the next program in
the pipeline cannot process. You should write such data to stderr instead.

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------


From: Angel Tsankov on

"Lew Pitcher" <lpitcher(a)teksavvy.com> wrote in message
news:c5830$485557b0$4c0aa283$18554(a)TEKSAVVY.COM-Free...
> In comp.unix.programmer, Angel Tsankov wrote:
>
>> Hello,
>>
>> Is there any convention as to what messages should go to stdout and what
>> to stderr? More specifically, where should I log errors that do not
>> prevent the program from finishing what it is doing?
>
> You should use stdout for the 'normal' output of your program, and stderr
> for /any/ diagnostic messages.
>
> Think of it this way: in a successful run, you only want stdout to contain
> data that can be piped in to the next program in the stream. For an
> unsuccessful run, stdout should not contain data that the next program in
> the pipeline cannot process. You should write such data to stderr instead.

Thanks for the detailed answer!