[RndTbl] Screen in production

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Wed Oct 10 10:33:33 CDT 2012


On 2012-10-10 09:50, Robert Keizer wrote:
> I have a production service that prints some debug to stdout. I could
> make it print to stderr, but it really doesn't matter in this case.

Are you sure it doesn't matter?  Read on...

> I want to have some hope of if something goes wrong figuring out what did.
> Log files aren't really an option so I ran it in screen. Yes yes I could
> have made it network log to somewhere else, but again, not really an
> viable option in this case. Works great as the program dies and the
> output stops, leaving the last debug messages in the buffer of screen.

One of the classic C/UNIX lessons about stdout vs stderr is that the C 
library buffers stdout by default but not stderr, exactly for the reason 
that you want error messages to be flushed out right away, leaving 
nothing in the buffer.  This is particularly important if the program 
dies in a way that prevents the usual exit processing, such as flushing 
buffers and closing file I/O.

So, issues with "screen" aside, you probably should either send your 
debug output to stderr, or set your stdout to unbuffered mode while 
debugging (or both).

-- 
Gilbert E. Detillieux		E-mail: <gedetil at muug.mb.ca>
Manitoba UNIX User Group	Web:	http://www.muug.mb.ca/
PO Box 130 St-Boniface		Phone:  (204)474-8161
Winnipeg MB CANADA  R2H 3B4	Fax:    (204)474-7609


More information about the Roundtable mailing list