[buug] Best practices for stderr messages?

Claude Rubinson cjr at grundrisse.org
Mon Dec 13 10:46:36 PST 2010

On Mon, Dec 13, 2010 at 10:26:19AM +0000, Nick Moffitt wrote:
> Claude Rubinson:
> > I'm not so interested in recommendations for formatting conventions
> > (although that would also be welcome) but, more specifically,
> > recommendations for phrasing, useful/conventional terminology, etc.  I
> > find myself struggling to balance clarity and brevity and am wondering
> > if somebody might have already talked about the issue.
> It depends entirely on what you are using stderr *for*, unfortunately.
> So many programs find stderr as a convenient reporting channel that it
> can tend to get noisy.  
> The big split I've found is basically this:
> 	1. Program results in files created/modified on filesystem.
> 	Stdout is used for status information and user prompts, and
> 	stderr is used for fault reporting.
> 	2. Program results in data spewed to stdout.  Stderr is used for
> 	any and all reporting to the user.

This is a helpful distinction.  My suite of programs definitely falls
into the latter category: filters reading stdin, outputting to stdout,
and with both fatal errors as well as warnings going to stderr.

It also suggests another way of asking my question: Does anybody have
suggestions of programs that I might emulate; ones that do a
particularly good job at providing useful-yet-manageable stderr

> Personally I've taken to using logging utilities for my stderr spew,

I hadn't considered that; it's an interesting idea that I'll have to



More information about the buug mailing list