Logging to console, should it go to stdout or stderr?
When logging to the console, is it a better convention to send log INFO messages to stdout or stderr? Taking Eclipse for example, when using the Java Logger class, it seems strange to me that INFO messages are sent to stderr (and so are red in Eclipse); this makes it more difficult to spot errors if you have many INFO messages. While researching how to change this behaviour, I stumbled upon this forum post:
> Simon wrote:
> cteb wrote:
> > Thanks for your help. However, I can't get my Formatter class to run.
> > My logging properties file is read (I left in an error by mistake and got
> > error messages on the console). Unfortunately, my formatter is never
> > used. The regular logging output is sent to the console (stderr instead
> > of stdout, for some reason; in Eclipse it's red now instead of
> > black).
> This is as expected. Why would you
> expect log messages to go to stdout?
> stdout should be used for the output
> or result of your program.
Source: Need help logging with java.util.logger
The default setting appears to send to stderr, so perhaps Simon is right. I suppose it is useful if you want to do:
./somecmd 1> somecmd.out 2> somecmd.log
... but isn't this abusing stderr? Surely only errors/warnings should go to this stream. My application logs all information messages to the logger, which means that my stdout channel is never used, which seems silly.