[slf4j-user] Re: Why 'simple' uses standard out?

Greg Wilkins gregw at mortbay.com
Sun Feb 26 16:57:21 CET 2006


guys,

Log output should go to stderr.

The whole point of stdout and stderr is that things the program is meant to do
go to stdout and everything meta about the program goes to stderr.

This all relates back to the principle in unix that everything is a file and
you should be able to pipe some things together.

So If I'm writing a new version of sort and I want to use slf4j then having it output
to stdout will just break it.  I will not be able to do such things as

  find . -name '*.java' | while read F; do echo $(basename $F):$F ; done | sort | cut -d: -f2

OK, so not many people do such things now, but the principle remains - stdout is only for 
the real output of your program, so unless your program is called "logstuff" then log 
output should go to stderr.

If your program does not produce any output that is streamable (eg only has a 
gui) then stdout should produce nothing.


turning to the font of all knowledge: http://en.wikipedia.org/wiki/Stderr


cheers




More information about the slf4j-user mailing list