|
Prev: fwrite over a pipe
Next: Excution causes No Match error
From: Angel Tsankov on 15 Jun 2008 04:38 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 15 Jun 2008 14:10 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 16 Jun 2008 08:08 "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!
|
Pages: 1 Prev: fwrite over a pipe Next: Excution causes No Match error |